UNPKG

@cdktf-providers/rancher-file

Version:

Prebuilt rancher/file Provider for Terraform CDK (cdktf)

188 lines (187 loc) 7.58 kB
// https://registry.terraform.io/providers/rancher/file/2.2.2/docs/data-sources/local_directory // generated from terraform resource schema import * as cdktf from 'cdktf'; export function dataFileLocalDirectoryFilesToTerraform(struct) { if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(struct)) { return struct; } if (cdktf.isComplexElement(struct)) { throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration"); } return {}; } export function dataFileLocalDirectoryFilesToHclTerraform(struct) { if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(struct)) { return struct; } if (cdktf.isComplexElement(struct)) { throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration"); } const attrs = {}; return attrs; } export class DataFileLocalDirectoryFilesOutputReference extends cdktf.ComplexObject { isEmptyObject = false; /** * @param terraformResource The parent resource * @param terraformAttribute The attribute on the parent resource this class is referencing * @param complexObjectIndex the index of this item in the list * @param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index) */ constructor(terraformResource, terraformAttribute, complexObjectIndex, complexObjectIsFromSet) { super(terraformResource, terraformAttribute, complexObjectIsFromSet, complexObjectIndex); } get internalValue() { let hasAnyValues = this.isEmptyObject; const internalValueResult = {}; return hasAnyValues ? internalValueResult : undefined; } set internalValue(value) { if (value === undefined) { this.isEmptyObject = false; } else { this.isEmptyObject = Object.keys(value).length === 0; } } // is_directory - computed: true, optional: false, required: false get isDirectory() { return this.getStringAttribute('is_directory'); } // last_modified - computed: true, optional: false, required: false get lastModified() { return this.getStringAttribute('last_modified'); } // name - computed: true, optional: false, required: false get name() { return this.getStringAttribute('name'); } // permissions - computed: true, optional: false, required: false get permissions() { return this.getStringAttribute('permissions'); } // size - computed: true, optional: false, required: false get size() { return this.getStringAttribute('size'); } } export class DataFileLocalDirectoryFilesList extends cdktf.ComplexList { terraformResource; terraformAttribute; wrapsSet; /** * @param terraformResource The parent resource * @param terraformAttribute The attribute on the parent resource this class is referencing * @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index) */ constructor(terraformResource, terraformAttribute, wrapsSet) { super(terraformResource, terraformAttribute, wrapsSet); this.terraformResource = terraformResource; this.terraformAttribute = terraformAttribute; this.wrapsSet = wrapsSet; } /** * @param index the index of the item to return */ get(index) { return new DataFileLocalDirectoryFilesOutputReference(this.terraformResource, this.terraformAttribute, index, this.wrapsSet); } } /** * Represents a {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/data-sources/local_directory file_local_directory} */ export class DataFileLocalDirectory extends cdktf.TerraformDataSource { // ================= // STATIC PROPERTIES // ================= static tfResourceType = "file_local_directory"; // ============== // STATIC Methods // ============== /** * Generates CDKTF code for importing a DataFileLocalDirectory 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 DataFileLocalDirectory to import * @param importFromId The id of the existing DataFileLocalDirectory that should be imported. Refer to the {@link https://registry.terraform.io/providers/rancher/file/2.2.2/docs/data-sources/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 DataFileLocalDirectory 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/data-sources/local_directory file_local_directory} 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 DataFileLocalDirectoryConfig */ 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; } // ========== // ATTRIBUTES // ========== // files - computed: true, optional: false, required: false _files = new DataFileLocalDirectoryFilesList(this, "files", false); get files() { return this._files; } // 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: false, required: false get permissions() { return this.getStringAttribute('permissions'); } // ========= // SYNTHESIS // ========= synthesizeAttributes() { return { path: cdktf.stringToTerraform(this._path), }; } synthesizeHclAttributes() { const attrs = { path: { value: cdktf.stringToHclTerraform(this._path), isBlock: false, type: "simple", storageClassType: "string", }, }; // remove undefined attributes return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined)); } }