@cdktf-providers/rancher-file
Version:
Prebuilt rancher/file Provider for Terraform CDK (cdktf)
224 lines (223 loc) • 7.75 kB
JavaScript
// https://registry.terraform.io/providers/rancher/file/2.2.2/docs/resources/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/resources/local file_local}
*/
export class Local extends cdktf.TerraformResource {
// =================
// STATIC PROPERTIES
// =================
static tfResourceType = "file_local";
// ==============
// STATIC Methods
// ==============
/**
* Generates CDKTF code for importing a Local 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 Local to import
* @param importFromId The id of the existing Local that should be imported. Refer to the {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/resources/local#import import section} in the documentation of this resource for the id to use
* @param provider? Optional instance of the provider where the Local 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/resources/local file_local} 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 LocalConfig
*/
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._contents = config.contents;
this._directory = config.directory;
this._hmacSecretKey = config.hmacSecretKey;
this._id = config.id;
this._name = config.name;
this._permissions = config.permissions;
this._protected = config.protected;
}
// ==========
// ATTRIBUTES
// ==========
// contents - computed: false, optional: false, required: true
_contents;
get contents() {
return this.getStringAttribute('contents');
}
set contents(value) {
this._contents = value;
}
// Temporarily expose input value. Use with caution.
get contentsInput() {
return this._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: true, required: false
_id;
get id() {
return this.getStringAttribute('id');
}
set id(value) {
this._id = value;
}
resetId() {
this._id = undefined;
}
// Temporarily expose input value. Use with caution.
get idInput() {
return this._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: 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;
}
// protected - computed: true, optional: true, required: false
_protected;
get protected() {
return this.getBooleanAttribute('protected');
}
set protected(value) {
this._protected = value;
}
resetProtected() {
this._protected = undefined;
}
// Temporarily expose input value. Use with caution.
get protectedInput() {
return this._protected;
}
// =========
// SYNTHESIS
// =========
synthesizeAttributes() {
return {
contents: cdktf.stringToTerraform(this._contents),
directory: cdktf.stringToTerraform(this._directory),
hmac_secret_key: cdktf.stringToTerraform(this._hmacSecretKey),
id: cdktf.stringToTerraform(this._id),
name: cdktf.stringToTerraform(this._name),
permissions: cdktf.stringToTerraform(this._permissions),
protected: cdktf.booleanToTerraform(this._protected),
};
}
synthesizeHclAttributes() {
const attrs = {
contents: {
value: cdktf.stringToHclTerraform(this._contents),
isBlock: false,
type: "simple",
storageClassType: "string",
},
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",
},
id: {
value: cdktf.stringToHclTerraform(this._id),
isBlock: false,
type: "simple",
storageClassType: "string",
},
name: {
value: cdktf.stringToHclTerraform(this._name),
isBlock: false,
type: "simple",
storageClassType: "string",
},
permissions: {
value: cdktf.stringToHclTerraform(this._permissions),
isBlock: false,
type: "simple",
storageClassType: "string",
},
protected: {
value: cdktf.booleanToHclTerraform(this._protected),
isBlock: false,
type: "simple",
storageClassType: "boolean",
},
};
// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));
}
}