UNPKG

@cdktf-providers/andrewchubatiuk-ignition

Version:

Prebuilt AndrewChubatiuk/ignition Provider for Terraform CDK (cdktf)

341 lines (340 loc) 12.4 kB
// https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/systemd_unit // generated from terraform resource schema import * as cdktf from 'cdktf'; export function dataIgnitionSystemdUnitDropinToTerraform(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 { content: cdktf.stringToTerraform(struct.content), name: cdktf.stringToTerraform(struct.name), }; } export function dataIgnitionSystemdUnitDropinToHclTerraform(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 = { content: { value: cdktf.stringToHclTerraform(struct.content), isBlock: false, type: "simple", storageClassType: "string", }, name: { value: cdktf.stringToHclTerraform(struct.name), isBlock: false, type: "simple", storageClassType: "string", }, }; // remove undefined attributes return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined)); } export class DataIgnitionSystemdUnitDropinOutputReference extends cdktf.ComplexObject { isEmptyObject = false; resolvableValue; /** * @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() { if (this.resolvableValue) { return this.resolvableValue; } let hasAnyValues = this.isEmptyObject; const internalValueResult = {}; if (this._content !== undefined) { hasAnyValues = true; internalValueResult.content = this._content; } if (this._name !== undefined) { hasAnyValues = true; internalValueResult.name = this._name; } return hasAnyValues ? internalValueResult : undefined; } set internalValue(value) { if (value === undefined) { this.isEmptyObject = false; this.resolvableValue = undefined; this._content = undefined; this._name = undefined; } else if (cdktf.Tokenization.isResolvable(value)) { this.isEmptyObject = false; this.resolvableValue = value; } else { this.isEmptyObject = Object.keys(value).length === 0; this.resolvableValue = undefined; this._content = value.content; this._name = value.name; } } // content - computed: false, optional: true, required: false _content; get content() { return this.getStringAttribute('content'); } set content(value) { this._content = value; } resetContent() { this._content = undefined; } // Temporarily expose input value. Use with caution. get contentInput() { return this._content; } // 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; } } export class DataIgnitionSystemdUnitDropinList extends cdktf.ComplexList { terraformResource; terraformAttribute; wrapsSet; internalValue; /** * @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 DataIgnitionSystemdUnitDropinOutputReference(this.terraformResource, this.terraformAttribute, index, this.wrapsSet); } } /** * Represents a {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/systemd_unit ignition_systemd_unit} */ export class DataIgnitionSystemdUnit extends cdktf.TerraformDataSource { // ================= // STATIC PROPERTIES // ================= static tfResourceType = "ignition_systemd_unit"; // ============== // STATIC Methods // ============== /** * Generates CDKTF code for importing a DataIgnitionSystemdUnit 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 DataIgnitionSystemdUnit to import * @param importFromId The id of the existing DataIgnitionSystemdUnit that should be imported. Refer to the {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/systemd_unit#import import section} in the documentation of this resource for the id to use * @param provider? Optional instance of the provider where the DataIgnitionSystemdUnit to import is found */ static generateConfigForImport(scope, importToId, importFromId, provider) { return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "ignition_systemd_unit", importId: importFromId, provider }); } // =========== // INITIALIZER // =========== /** * Create a new {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/systemd_unit ignition_systemd_unit} 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 DataIgnitionSystemdUnitConfig */ constructor(scope, id, config) { super(scope, id, { terraformResourceType: 'ignition_systemd_unit', terraformGeneratorMetadata: { providerName: 'ignition', providerVersion: '0.0.1', providerVersionConstraint: '0.0.1' }, provider: config.provider, dependsOn: config.dependsOn, count: config.count, lifecycle: config.lifecycle, provisioners: config.provisioners, connection: config.connection, forEach: config.forEach }); this._content = config.content; this._enabled = config.enabled; this._id = config.id; this._mask = config.mask; this._name = config.name; this._dropin.internalValue = config.dropin; } // ========== // ATTRIBUTES // ========== // content - computed: false, optional: true, required: false _content; get content() { return this.getStringAttribute('content'); } set content(value) { this._content = value; } resetContent() { this._content = undefined; } // Temporarily expose input value. Use with caution. get contentInput() { return this._content; } // enabled - computed: false, optional: true, required: false _enabled; get enabled() { return this.getBooleanAttribute('enabled'); } set enabled(value) { this._enabled = value; } resetEnabled() { this._enabled = undefined; } // Temporarily expose input value. Use with caution. get enabledInput() { return this._enabled; } // 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; } // mask - computed: false, optional: true, required: false _mask; get mask() { return this.getBooleanAttribute('mask'); } set mask(value) { this._mask = value; } resetMask() { this._mask = undefined; } // Temporarily expose input value. Use with caution. get maskInput() { return this._mask; } // 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; } // rendered - computed: true, optional: false, required: false get rendered() { return this.getStringAttribute('rendered'); } // dropin - computed: false, optional: true, required: false _dropin = new DataIgnitionSystemdUnitDropinList(this, "dropin", false); get dropin() { return this._dropin; } putDropin(value) { this._dropin.internalValue = value; } resetDropin() { this._dropin.internalValue = undefined; } // Temporarily expose input value. Use with caution. get dropinInput() { return this._dropin.internalValue; } // ========= // SYNTHESIS // ========= synthesizeAttributes() { return { content: cdktf.stringToTerraform(this._content), enabled: cdktf.booleanToTerraform(this._enabled), id: cdktf.stringToTerraform(this._id), mask: cdktf.booleanToTerraform(this._mask), name: cdktf.stringToTerraform(this._name), dropin: cdktf.listMapper(dataIgnitionSystemdUnitDropinToTerraform, true)(this._dropin.internalValue), }; } synthesizeHclAttributes() { const attrs = { content: { value: cdktf.stringToHclTerraform(this._content), isBlock: false, type: "simple", storageClassType: "string", }, enabled: { value: cdktf.booleanToHclTerraform(this._enabled), isBlock: false, type: "simple", storageClassType: "boolean", }, id: { value: cdktf.stringToHclTerraform(this._id), isBlock: false, type: "simple", storageClassType: "string", }, mask: { value: cdktf.booleanToHclTerraform(this._mask), isBlock: false, type: "simple", storageClassType: "boolean", }, name: { value: cdktf.stringToHclTerraform(this._name), isBlock: false, type: "simple", storageClassType: "string", }, dropin: { value: cdktf.listMapperHcl(dataIgnitionSystemdUnitDropinToHclTerraform, true)(this._dropin.internalValue), isBlock: true, type: "list", storageClassType: "DataIgnitionSystemdUnitDropinList", }, }; // remove undefined attributes return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined)); } }