@cdktf-providers/rancher-file
Version:
Prebuilt rancher/file Provider for Terraform CDK (cdktf)
147 lines (146 loc) • 5.42 kB
JavaScript
// https://registry.terraform.io/providers/rancher/file/2.2.2/docs/data-sources/local
// generated from terraform resource schema
import * as cdktf from 'cdktf';
/**
* Represents a {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/data-sources/local file_local}
*/
export class DataFileLocal extends cdktf.TerraformDataSource {
// =================
// STATIC PROPERTIES
// =================
static tfResourceType = "file_local";
// ==============
// STATIC Methods
// ==============
/**
* Generates CDKTF code for importing a DataFileLocal resource upon running "cdktf plan <stack-name>"
* @param scope The scope in which to define this construct
* @param importToId The construct id used in the generated config for the DataFileLocal to import
* @param importFromId The id of the existing DataFileLocal that should be imported. Refer to the {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/data-sources/local#import import section} in the documentation of this resource for the id to use
* @param provider? Optional instance of the provider where the DataFileLocal to import is found
*/
static generateConfigForImport(scope, importToId, importFromId, provider) {
return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "file_local", importId: importFromId, provider });
}
// ===========
// INITIALIZER
// ===========
/**
* Create a new {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/data-sources/local file_local} Data Source
*
* @param scope The scope in which to define this construct
* @param id The scoped construct ID. Must be unique amongst siblings in the same scope
* @param options DataFileLocalConfig
*/
constructor(scope, id, config) {
super(scope, id, {
terraformResourceType: 'file_local',
terraformGeneratorMetadata: {
providerName: 'file',
providerVersion: '2.2.2',
providerVersionConstraint: '2.2.2'
},
provider: config.provider,
dependsOn: config.dependsOn,
count: config.count,
lifecycle: config.lifecycle,
provisioners: config.provisioners,
connection: config.connection,
forEach: config.forEach
});
this._directory = config.directory;
this._hmacSecretKey = config.hmacSecretKey;
this._name = config.name;
}
// ==========
// ATTRIBUTES
// ==========
// contents - computed: true, optional: false, required: false
get contents() {
return this.getStringAttribute('contents');
}
// directory - computed: true, optional: true, required: false
_directory;
get directory() {
return this.getStringAttribute('directory');
}
set directory(value) {
this._directory = value;
}
resetDirectory() {
this._directory = undefined;
}
// Temporarily expose input value. Use with caution.
get directoryInput() {
return this._directory;
}
// hmac_secret_key - computed: true, optional: true, required: false
_hmacSecretKey;
get hmacSecretKey() {
return this.getStringAttribute('hmac_secret_key');
}
set hmacSecretKey(value) {
this._hmacSecretKey = value;
}
resetHmacSecretKey() {
this._hmacSecretKey = undefined;
}
// Temporarily expose input value. Use with caution.
get hmacSecretKeyInput() {
return this._hmacSecretKey;
}
// id - computed: true, optional: false, required: false
get id() {
return this.getStringAttribute('id');
}
// name - computed: false, optional: false, required: true
_name;
get name() {
return this.getStringAttribute('name');
}
set name(value) {
this._name = value;
}
// Temporarily expose input value. Use with caution.
get nameInput() {
return this._name;
}
// permissions - computed: true, optional: false, required: false
get permissions() {
return this.getStringAttribute('permissions');
}
// =========
// SYNTHESIS
// =========
synthesizeAttributes() {
return {
directory: cdktf.stringToTerraform(this._directory),
hmac_secret_key: cdktf.stringToTerraform(this._hmacSecretKey),
name: cdktf.stringToTerraform(this._name),
};
}
synthesizeHclAttributes() {
const attrs = {
directory: {
value: cdktf.stringToHclTerraform(this._directory),
isBlock: false,
type: "simple",
storageClassType: "string",
},
hmac_secret_key: {
value: cdktf.stringToHclTerraform(this._hmacSecretKey),
isBlock: false,
type: "simple",
storageClassType: "string",
},
name: {
value: cdktf.stringToHclTerraform(this._name),
isBlock: false,
type: "simple",
storageClassType: "string",
},
};
// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));
}
}