@cdktf-providers/andrewchubatiuk-ignition
Version:
Prebuilt AndrewChubatiuk/ignition Provider for Terraform CDK (cdktf)
481 lines (480 loc) • 16.6 kB
JavaScript
// https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/file
// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function dataIgnitionFileContentToTerraform(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),
mime: cdktf.stringToTerraform(struct.mime),
};
}
export function dataIgnitionFileContentToHclTerraform(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",
},
mime: {
value: cdktf.stringToHclTerraform(struct.mime),
isBlock: false,
type: "simple",
storageClassType: "string",
},
};
// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));
}
export class DataIgnitionFileContentOutputReference extends cdktf.ComplexObject {
isEmptyObject = false;
/**
* @param terraformResource The parent resource
* @param terraformAttribute The attribute on the parent resource this class is referencing
*/
constructor(terraformResource, terraformAttribute) {
super(terraformResource, terraformAttribute, false, 0);
}
get internalValue() {
let hasAnyValues = this.isEmptyObject;
const internalValueResult = {};
if (this._content !== undefined) {
hasAnyValues = true;
internalValueResult.content = this._content;
}
if (this._mime !== undefined) {
hasAnyValues = true;
internalValueResult.mime = this._mime;
}
return hasAnyValues ? internalValueResult : undefined;
}
set internalValue(value) {
if (value === undefined) {
this.isEmptyObject = false;
this._content = undefined;
this._mime = undefined;
}
else {
this.isEmptyObject = Object.keys(value).length === 0;
this._content = value.content;
this._mime = value.mime;
}
}
// content - computed: false, optional: false, required: true
_content;
get content() {
return this.getStringAttribute('content');
}
set content(value) {
this._content = value;
}
// Temporarily expose input value. Use with caution.
get contentInput() {
return this._content;
}
// mime - computed: false, optional: true, required: false
_mime;
get mime() {
return this.getStringAttribute('mime');
}
set mime(value) {
this._mime = value;
}
resetMime() {
this._mime = undefined;
}
// Temporarily expose input value. Use with caution.
get mimeInput() {
return this._mime;
}
}
export function dataIgnitionFileSourceToTerraform(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 {
compression: cdktf.stringToTerraform(struct.compression),
source: cdktf.stringToTerraform(struct.source),
verification: cdktf.stringToTerraform(struct.verification),
};
}
export function dataIgnitionFileSourceToHclTerraform(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 = {
compression: {
value: cdktf.stringToHclTerraform(struct.compression),
isBlock: false,
type: "simple",
storageClassType: "string",
},
source: {
value: cdktf.stringToHclTerraform(struct.source),
isBlock: false,
type: "simple",
storageClassType: "string",
},
verification: {
value: cdktf.stringToHclTerraform(struct.verification),
isBlock: false,
type: "simple",
storageClassType: "string",
},
};
// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));
}
export class DataIgnitionFileSourceOutputReference extends cdktf.ComplexObject {
isEmptyObject = false;
/**
* @param terraformResource The parent resource
* @param terraformAttribute The attribute on the parent resource this class is referencing
*/
constructor(terraformResource, terraformAttribute) {
super(terraformResource, terraformAttribute, false, 0);
}
get internalValue() {
let hasAnyValues = this.isEmptyObject;
const internalValueResult = {};
if (this._compression !== undefined) {
hasAnyValues = true;
internalValueResult.compression = this._compression;
}
if (this._source !== undefined) {
hasAnyValues = true;
internalValueResult.source = this._source;
}
if (this._verification !== undefined) {
hasAnyValues = true;
internalValueResult.verification = this._verification;
}
return hasAnyValues ? internalValueResult : undefined;
}
set internalValue(value) {
if (value === undefined) {
this.isEmptyObject = false;
this._compression = undefined;
this._source = undefined;
this._verification = undefined;
}
else {
this.isEmptyObject = Object.keys(value).length === 0;
this._compression = value.compression;
this._source = value.source;
this._verification = value.verification;
}
}
// compression - computed: false, optional: true, required: false
_compression;
get compression() {
return this.getStringAttribute('compression');
}
set compression(value) {
this._compression = value;
}
resetCompression() {
this._compression = undefined;
}
// Temporarily expose input value. Use with caution.
get compressionInput() {
return this._compression;
}
// source - computed: false, optional: true, required: false
_source;
get source() {
return this.getStringAttribute('source');
}
set source(value) {
this._source = value;
}
resetSource() {
this._source = undefined;
}
// Temporarily expose input value. Use with caution.
get sourceInput() {
return this._source;
}
// verification - computed: false, optional: true, required: false
_verification;
get verification() {
return this.getStringAttribute('verification');
}
set verification(value) {
this._verification = value;
}
resetVerification() {
this._verification = undefined;
}
// Temporarily expose input value. Use with caution.
get verificationInput() {
return this._verification;
}
}
/**
* Represents a {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/file ignition_file}
*/
export class DataIgnitionFile extends cdktf.TerraformDataSource {
// =================
// STATIC PROPERTIES
// =================
static tfResourceType = "ignition_file";
// ==============
// STATIC Methods
// ==============
/**
* Generates CDKTF code for importing a DataIgnitionFile 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 DataIgnitionFile to import
* @param importFromId The id of the existing DataIgnitionFile that should be imported. Refer to the {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/file#import import section} in the documentation of this resource for the id to use
* @param provider? Optional instance of the provider where the DataIgnitionFile to import is found
*/
static generateConfigForImport(scope, importToId, importFromId, provider) {
return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "ignition_file", importId: importFromId, provider });
}
// ===========
// INITIALIZER
// ===========
/**
* Create a new {@link https://registry.terraform.io/providers/andrewchubatiuk/ignition/0.0.1/docs/data-sources/file ignition_file} 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 DataIgnitionFileConfig
*/
constructor(scope, id, config) {
super(scope, id, {
terraformResourceType: 'ignition_file',
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._gid = config.gid;
this._id = config.id;
this._mode = config.mode;
this._overwrite = config.overwrite;
this._path = config.path;
this._uid = config.uid;
this._content.internalValue = config.content;
this._source.internalValue = config.source;
}
// ==========
// ATTRIBUTES
// ==========
// gid - computed: false, optional: true, required: false
_gid;
get gid() {
return this.getNumberAttribute('gid');
}
set gid(value) {
this._gid = value;
}
resetGid() {
this._gid = undefined;
}
// Temporarily expose input value. Use with caution.
get gidInput() {
return this._gid;
}
// 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;
}
// mode - computed: false, optional: true, required: false
_mode;
get mode() {
return this.getNumberAttribute('mode');
}
set mode(value) {
this._mode = value;
}
resetMode() {
this._mode = undefined;
}
// Temporarily expose input value. Use with caution.
get modeInput() {
return this._mode;
}
// overwrite - computed: false, optional: true, required: false
_overwrite;
get overwrite() {
return this.getBooleanAttribute('overwrite');
}
set overwrite(value) {
this._overwrite = value;
}
resetOverwrite() {
this._overwrite = undefined;
}
// Temporarily expose input value. Use with caution.
get overwriteInput() {
return this._overwrite;
}
// 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;
}
// rendered - computed: true, optional: false, required: false
get rendered() {
return this.getStringAttribute('rendered');
}
// uid - computed: false, optional: true, required: false
_uid;
get uid() {
return this.getNumberAttribute('uid');
}
set uid(value) {
this._uid = value;
}
resetUid() {
this._uid = undefined;
}
// Temporarily expose input value. Use with caution.
get uidInput() {
return this._uid;
}
// content - computed: false, optional: true, required: false
_content = new DataIgnitionFileContentOutputReference(this, "content");
get content() {
return this._content;
}
putContent(value) {
this._content.internalValue = value;
}
resetContent() {
this._content.internalValue = undefined;
}
// Temporarily expose input value. Use with caution.
get contentInput() {
return this._content.internalValue;
}
// source - computed: false, optional: true, required: false
_source = new DataIgnitionFileSourceOutputReference(this, "source");
get source() {
return this._source;
}
putSource(value) {
this._source.internalValue = value;
}
resetSource() {
this._source.internalValue = undefined;
}
// Temporarily expose input value. Use with caution.
get sourceInput() {
return this._source.internalValue;
}
// =========
// SYNTHESIS
// =========
synthesizeAttributes() {
return {
gid: cdktf.numberToTerraform(this._gid),
id: cdktf.stringToTerraform(this._id),
mode: cdktf.numberToTerraform(this._mode),
overwrite: cdktf.booleanToTerraform(this._overwrite),
path: cdktf.stringToTerraform(this._path),
uid: cdktf.numberToTerraform(this._uid),
content: dataIgnitionFileContentToTerraform(this._content.internalValue),
source: dataIgnitionFileSourceToTerraform(this._source.internalValue),
};
}
synthesizeHclAttributes() {
const attrs = {
gid: {
value: cdktf.numberToHclTerraform(this._gid),
isBlock: false,
type: "simple",
storageClassType: "number",
},
id: {
value: cdktf.stringToHclTerraform(this._id),
isBlock: false,
type: "simple",
storageClassType: "string",
},
mode: {
value: cdktf.numberToHclTerraform(this._mode),
isBlock: false,
type: "simple",
storageClassType: "number",
},
overwrite: {
value: cdktf.booleanToHclTerraform(this._overwrite),
isBlock: false,
type: "simple",
storageClassType: "boolean",
},
path: {
value: cdktf.stringToHclTerraform(this._path),
isBlock: false,
type: "simple",
storageClassType: "string",
},
uid: {
value: cdktf.numberToHclTerraform(this._uid),
isBlock: false,
type: "simple",
storageClassType: "number",
},
content: {
value: dataIgnitionFileContentToHclTerraform(this._content.internalValue),
isBlock: true,
type: "list",
storageClassType: "DataIgnitionFileContentList",
},
source: {
value: dataIgnitionFileSourceToHclTerraform(this._source.internalValue),
isBlock: true,
type: "list",
storageClassType: "DataIgnitionFileSourceList",
},
};
// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));
}
}