@cdktf-providers/rancher-file
Version:
Prebuilt rancher/file Provider for Terraform CDK (cdktf)
120 lines (119 loc) • 4.56 kB
JavaScript
// https://registry.terraform.io/providers/rancher/file/2.2.2/docs/resources/local_directory
// generated from terraform resource schema
import * as cdktf from 'cdktf';
/**
* Represents a {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/resources/local_directory file_local_directory}
*/
export class LocalDirectory extends cdktf.TerraformResource {
// =================
// STATIC PROPERTIES
// =================
static tfResourceType = "file_local_directory";
// ==============
// STATIC Methods
// ==============
/**
* Generates CDKTF code for importing a LocalDirectory 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 LocalDirectory to import
* @param importFromId The id of the existing LocalDirectory that should be imported. Refer to the {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/resources/local_directory#import import section} in the documentation of this resource for the id to use
* @param provider? Optional instance of the provider where the LocalDirectory to import is found
*/
static generateConfigForImport(scope, importToId, importFromId, provider) {
return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "file_local_directory", importId: importFromId, provider });
}
// ===========
// INITIALIZER
// ===========
/**
* Create a new {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/resources/local_directory file_local_directory} Resource
*
* @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 LocalDirectoryConfig
*/
constructor(scope, id, config) {
super(scope, id, {
terraformResourceType: 'file_local_directory',
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._path = config.path;
this._permissions = config.permissions;
}
// ==========
// ATTRIBUTES
// ==========
// created - computed: true, optional: false, required: false
get created() {
return this.getStringAttribute('created');
}
// id - computed: true, optional: false, required: false
get id() {
return this.getStringAttribute('id');
}
// path - computed: false, optional: false, required: true
_path;
get path() {
return this.getStringAttribute('path');
}
set path(value) {
this._path = value;
}
// Temporarily expose input value. Use with caution.
get pathInput() {
return this._path;
}
// permissions - computed: true, optional: true, required: false
_permissions;
get permissions() {
return this.getStringAttribute('permissions');
}
set permissions(value) {
this._permissions = value;
}
resetPermissions() {
this._permissions = undefined;
}
// Temporarily expose input value. Use with caution.
get permissionsInput() {
return this._permissions;
}
// =========
// SYNTHESIS
// =========
synthesizeAttributes() {
return {
path: cdktf.stringToTerraform(this._path),
permissions: cdktf.stringToTerraform(this._permissions),
};
}
synthesizeHclAttributes() {
const attrs = {
path: {
value: cdktf.stringToHclTerraform(this._path),
isBlock: false,
type: "simple",
storageClassType: "string",
},
permissions: {
value: cdktf.stringToHclTerraform(this._permissions),
isBlock: false,
type: "simple",
storageClassType: "string",
},
};
// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));
}
}