Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(provider-generator): Skip definition attribute for aws_quicksight_analysis.definition data source #3725

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,331 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`skips attributes in the disallow list: quicksight-template 1`] = `
exports[`skips attribute type attributes in the disallow list: data-quicksight-analysis 1`] = `
"// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis
// generated from terraform resource schema

import { Construct } from 'constructs';
import * as cdktf from 'cdktf';

// Configuration

export interface DataAwsQuicksightAnalysisConfig extends cdktf.TerraformMetaArguments {
/**
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis#analysis_id DataAwsQuicksightAnalysis#analysis_id}
*/
readonly analysisId: string;
/**
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis#aws_account_id DataAwsQuicksightAnalysis#aws_account_id}
*/
readonly awsAccountId?: string;
/**
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis#id DataAwsQuicksightAnalysis#id}
*
* Please be aware that the id field is automatically added to all resources in Terraform providers using a Terraform provider SDK version below 2.
* If you experience problems setting this value it might not be settable. Please take a look at the provider documentation to ensure it should be settable.
*/
readonly id?: string;
/**
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis#tags DataAwsQuicksightAnalysis#tags}
*/
readonly tags?: { [key: string]: string };
}
export interface DataAwsQuicksightAnalysisPermissions {
}

export function dataAwsQuicksightAnalysisPermissionsToTerraform(struct?: DataAwsQuicksightAnalysisPermissions): any {
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 dataAwsQuicksightAnalysisPermissionsToHclTerraform(struct?: DataAwsQuicksightAnalysisPermissions): any {
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 DataAwsQuicksightAnalysisPermissionsOutputReference extends cdktf.ComplexObject {
private 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)
*/
public constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean) {
super(terraformResource, terraformAttribute, complexObjectIsFromSet, complexObjectIndex);
}

public get internalValue(): DataAwsQuicksightAnalysisPermissions | undefined {
let hasAnyValues = this.isEmptyObject;
const internalValueResult: any = {};
return hasAnyValues ? internalValueResult : undefined;
}

public set internalValue(value: DataAwsQuicksightAnalysisPermissions | undefined) {
if (value === undefined) {
this.isEmptyObject = false;
}
else {
this.isEmptyObject = Object.keys(value).length === 0;
}
}

// actions - computed: true, optional: false, required: false
public get actions() {
return cdktf.Fn.tolist(this.getListAttribute('actions'));
}

// principal - computed: true, optional: false, required: false
public get principal() {
return this.getStringAttribute('principal');
}
}

export class DataAwsQuicksightAnalysisPermissionsList extends cdktf.ComplexList {

/**
* @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(protected terraformResource: cdktf.IInterpolatingParent, protected terraformAttribute: string, protected wrapsSet: boolean) {
super(terraformResource, terraformAttribute, wrapsSet)
}

/**
* @param index the index of the item to return
*/
public get(index: number): DataAwsQuicksightAnalysisPermissionsOutputReference {
return new DataAwsQuicksightAnalysisPermissionsOutputReference(this.terraformResource, this.terraformAttribute, index, this.wrapsSet);
}
}

/**
* Represents a {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis aws_quicksight_analysis}
*/
export class DataAwsQuicksightAnalysis extends cdktf.TerraformDataSource {

// =================
// STATIC PROPERTIES
// =================
public static readonly tfResourceType = "aws_quicksight_analysis";

// ==============
// STATIC Methods
// ==============
/**
* Generates CDKTF code for importing a DataAwsQuicksightAnalysis 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 DataAwsQuicksightAnalysis to import
* @param importFromId The id of the existing DataAwsQuicksightAnalysis that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis#import import section} in the documentation of this resource for the id to use
* @param provider? Optional instance of the provider where the DataAwsQuicksightAnalysis to import is found
*/
public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) {
return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_quicksight_analysis", importId: importFromId, provider });
}

// ===========
// INITIALIZER
// ===========

/**
* Create a new {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis aws_quicksight_analysis} 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 DataAwsQuicksightAnalysisConfig
*/
public constructor(scope: Construct, id: string, config: DataAwsQuicksightAnalysisConfig) {
super(scope, id, {
terraformResourceType: 'aws_quicksight_analysis',
terraformGeneratorMetadata: {
providerName: 'aws'
},
provider: config.provider,
dependsOn: config.dependsOn,
count: config.count,
lifecycle: config.lifecycle,
provisioners: config.provisioners,
connection: config.connection,
forEach: config.forEach
});
this._analysisId = config.analysisId;
this._awsAccountId = config.awsAccountId;
this._id = config.id;
this._tags = config.tags;
}

// ==========
// ATTRIBUTES
// ==========

// analysis_id - computed: false, optional: false, required: true
private _analysisId?: string;
public get analysisId() {
return this.getStringAttribute('analysis_id');
}
public set analysisId(value: string) {
this._analysisId = value;
}
// Temporarily expose input value. Use with caution.
public get analysisIdInput() {
return this._analysisId;
}

// arn - computed: true, optional: false, required: false
public get arn() {
return this.getStringAttribute('arn');
}

// aws_account_id - computed: true, optional: true, required: false
private _awsAccountId?: string;
public get awsAccountId() {
return this.getStringAttribute('aws_account_id');
}
public set awsAccountId(value: string) {
this._awsAccountId = value;
}
public resetAwsAccountId() {
this._awsAccountId = undefined;
}
// Temporarily expose input value. Use with caution.
public get awsAccountIdInput() {
return this._awsAccountId;
}

// created_time - computed: true, optional: false, required: false
public get createdTime() {
return this.getStringAttribute('created_time');
}

// definition - computed: true, optional: false, required: false
public get definition() {
return this.getAnyAttribute('definition');
}
ansgarm marked this conversation as resolved.
Show resolved Hide resolved

// id - computed: true, optional: true, required: false
private _id?: string;
public get id() {
return this.getStringAttribute('id');
}
public set id(value: string) {
this._id = value;
}
public resetId() {
this._id = undefined;
}
// Temporarily expose input value. Use with caution.
public get idInput() {
return this._id;
}

// last_published_time - computed: true, optional: false, required: false
public get lastPublishedTime() {
return this.getStringAttribute('last_published_time');
}

// last_updated_time - computed: true, optional: false, required: false
public get lastUpdatedTime() {
return this.getStringAttribute('last_updated_time');
}

// name - computed: true, optional: false, required: false
public get name() {
return this.getStringAttribute('name');
}

// permissions - computed: true, optional: false, required: false
private _permissions = new DataAwsQuicksightAnalysisPermissionsList(this, "permissions", false);
public get permissions() {
return this._permissions;
}

// status - computed: true, optional: false, required: false
public get status() {
return this.getStringAttribute('status');
}

// tags - computed: true, optional: true, required: false
private _tags?: { [key: string]: string };
public get tags() {
return this.getStringMapAttribute('tags');
}
public set tags(value: { [key: string]: string }) {
this._tags = value;
}
public resetTags() {
this._tags = undefined;
}
// Temporarily expose input value. Use with caution.
public get tagsInput() {
return this._tags;
}

// theme_arn - computed: true, optional: false, required: false
public get themeArn() {
return this.getStringAttribute('theme_arn');
}

// =========
// SYNTHESIS
// =========

protected synthesizeAttributes(): { [name: string]: any } {
return {
analysis_id: cdktf.stringToTerraform(this._analysisId),
aws_account_id: cdktf.stringToTerraform(this._awsAccountId),
id: cdktf.stringToTerraform(this._id),
tags: cdktf.hashMapper(cdktf.stringToTerraform)(this._tags),
};
}

protected synthesizeHclAttributes(): { [name: string]: any } {
const attrs = {
analysis_id: {
value: cdktf.stringToHclTerraform(this._analysisId),
isBlock: false,
type: "simple",
storageClassType: "string",
},
aws_account_id: {
value: cdktf.stringToHclTerraform(this._awsAccountId),
isBlock: false,
type: "simple",
storageClassType: "string",
},
id: {
value: cdktf.stringToHclTerraform(this._id),
isBlock: false,
type: "simple",
storageClassType: "string",
},
tags: {
value: cdktf.hashMapperHcl(cdktf.stringToHclTerraform)(this._tags),
isBlock: false,
type: "map",
storageClassType: "stringMap",
},
};

// remove undefined attributes
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined ))
}
}
"
`;

exports[`skips block type attributes in the disallow list: quicksight-template 1`] = `
"// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/quicksight_template
// generated from terraform resource schema

Expand Down
Loading
Loading