@cdktf-providers/andrewchubatiuk-ignition
Version:
Prebuilt AndrewChubatiuk/ignition Provider for Terraform CDK (cdktf)
382 lines (381 loc) • 13.7 kB
JavaScript
// https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/disk
// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function dataIgnitionDiskPartitionToTerraform(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 {
label: cdktf.stringToTerraform(struct.label),
number: cdktf.numberToTerraform(struct.number),
sizemib: cdktf.numberToTerraform(struct.sizemib),
startmib: cdktf.numberToTerraform(struct.startmib),
type_guid: cdktf.stringToTerraform(struct.typeGuid),
};
}
export function dataIgnitionDiskPartitionToHclTerraform(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 = {
label: {
value: cdktf.stringToHclTerraform(struct.label),
isBlock: false,
type: "simple",
storageClassType: "string",
},
number: {
value: cdktf.numberToHclTerraform(struct.number),
isBlock: false,
type: "simple",
storageClassType: "number",
},
sizemib: {
value: cdktf.numberToHclTerraform(struct.sizemib),
isBlock: false,
type: "simple",
storageClassType: "number",
},
startmib: {
value: cdktf.numberToHclTerraform(struct.startmib),
isBlock: false,
type: "simple",
storageClassType: "number",
},
type_guid: {
value: cdktf.stringToHclTerraform(struct.typeGuid),
isBlock: false,
type: "simple",
storageClassType: "string",
},
};
// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));
}
export class DataIgnitionDiskPartitionOutputReference 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._label !== undefined) {
hasAnyValues = true;
internalValueResult.label = this._label;
}
if (this._number !== undefined) {
hasAnyValues = true;
internalValueResult.number = this._number;
}
if (this._sizemib !== undefined) {
hasAnyValues = true;
internalValueResult.sizemib = this._sizemib;
}
if (this._startmib !== undefined) {
hasAnyValues = true;
internalValueResult.startmib = this._startmib;
}
if (this._typeGuid !== undefined) {
hasAnyValues = true;
internalValueResult.typeGuid = this._typeGuid;
}
return hasAnyValues ? internalValueResult : undefined;
}
set internalValue(value) {
if (value === undefined) {
this.isEmptyObject = false;
this.resolvableValue = undefined;
this._label = undefined;
this._number = undefined;
this._sizemib = undefined;
this._startmib = undefined;
this._typeGuid = 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._label = value.label;
this._number = value.number;
this._sizemib = value.sizemib;
this._startmib = value.startmib;
this._typeGuid = value.typeGuid;
}
}
// label - computed: false, optional: true, required: false
_label;
get label() {
return this.getStringAttribute('label');
}
set label(value) {
this._label = value;
}
resetLabel() {
this._label = undefined;
}
// Temporarily expose input value. Use with caution.
get labelInput() {
return this._label;
}
// number - computed: false, optional: true, required: false
_number;
get number() {
return this.getNumberAttribute('number');
}
set number(value) {
this._number = value;
}
resetNumber() {
this._number = undefined;
}
// Temporarily expose input value. Use with caution.
get numberInput() {
return this._number;
}
// sizemib - computed: false, optional: true, required: false
_sizemib;
get sizemib() {
return this.getNumberAttribute('sizemib');
}
set sizemib(value) {
this._sizemib = value;
}
resetSizemib() {
this._sizemib = undefined;
}
// Temporarily expose input value. Use with caution.
get sizemibInput() {
return this._sizemib;
}
// startmib - computed: false, optional: true, required: false
_startmib;
get startmib() {
return this.getNumberAttribute('startmib');
}
set startmib(value) {
this._startmib = value;
}
resetStartmib() {
this._startmib = undefined;
}
// Temporarily expose input value. Use with caution.
get startmibInput() {
return this._startmib;
}
// type_guid - computed: false, optional: true, required: false
_typeGuid;
get typeGuid() {
return this.getStringAttribute('type_guid');
}
set typeGuid(value) {
this._typeGuid = value;
}
resetTypeGuid() {
this._typeGuid = undefined;
}
// Temporarily expose input value. Use with caution.
get typeGuidInput() {
return this._typeGuid;
}
}
export class DataIgnitionDiskPartitionList 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 DataIgnitionDiskPartitionOutputReference(this.terraformResource, this.terraformAttribute, index, this.wrapsSet);
}
}
/**
* Represents a {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/disk ignition_disk}
*/
export class DataIgnitionDisk extends cdktf.TerraformDataSource {
// =================
// STATIC PROPERTIES
// =================
static tfResourceType = "ignition_disk";
// ==============
// STATIC Methods
// ==============
/**
* Generates CDKTF code for importing a DataIgnitionDisk 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 DataIgnitionDisk to import
* @param importFromId The id of the existing DataIgnitionDisk that should be imported. Refer to the {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/disk#import import section} in the documentation of this resource for the id to use
* @param provider? Optional instance of the provider where the DataIgnitionDisk to import is found
*/
static generateConfigForImport(scope, importToId, importFromId, provider) {
return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "ignition_disk", importId: importFromId, provider });
}
// ===========
// INITIALIZER
// ===========
/**
* Create a new {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/disk ignition_disk} 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 DataIgnitionDiskConfig
*/
constructor(scope, id, config) {
super(scope, id, {
terraformResourceType: 'ignition_disk',
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._device = config.device;
this._id = config.id;
this._wipeTable = config.wipeTable;
this._partition.internalValue = config.partition;
}
// ==========
// ATTRIBUTES
// ==========
// device - computed: false, optional: false, required: true
_device;
get device() {
return this.getStringAttribute('device');
}
set device(value) {
this._device = value;
}
// Temporarily expose input value. Use with caution.
get deviceInput() {
return this._device;
}
// 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;
}
// rendered - computed: true, optional: false, required: false
get rendered() {
return this.getStringAttribute('rendered');
}
// wipe_table - computed: false, optional: true, required: false
_wipeTable;
get wipeTable() {
return this.getBooleanAttribute('wipe_table');
}
set wipeTable(value) {
this._wipeTable = value;
}
resetWipeTable() {
this._wipeTable = undefined;
}
// Temporarily expose input value. Use with caution.
get wipeTableInput() {
return this._wipeTable;
}
// partition - computed: false, optional: true, required: false
_partition = new DataIgnitionDiskPartitionList(this, "partition", false);
get partition() {
return this._partition;
}
putPartition(value) {
this._partition.internalValue = value;
}
resetPartition() {
this._partition.internalValue = undefined;
}
// Temporarily expose input value. Use with caution.
get partitionInput() {
return this._partition.internalValue;
}
// =========
// SYNTHESIS
// =========
synthesizeAttributes() {
return {
device: cdktf.stringToTerraform(this._device),
id: cdktf.stringToTerraform(this._id),
wipe_table: cdktf.booleanToTerraform(this._wipeTable),
partition: cdktf.listMapper(dataIgnitionDiskPartitionToTerraform, true)(this._partition.internalValue),
};
}
synthesizeHclAttributes() {
const attrs = {
device: {
value: cdktf.stringToHclTerraform(this._device),
isBlock: false,
type: "simple",
storageClassType: "string",
},
id: {
value: cdktf.stringToHclTerraform(this._id),
isBlock: false,
type: "simple",
storageClassType: "string",
},
wipe_table: {
value: cdktf.booleanToHclTerraform(this._wipeTable),
isBlock: false,
type: "simple",
storageClassType: "boolean",
},
partition: {
value: cdktf.listMapperHcl(dataIgnitionDiskPartitionToHclTerraform, true)(this._partition.internalValue),
isBlock: true,
type: "list",
storageClassType: "DataIgnitionDiskPartitionList",
},
};
// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));
}
}