Skip to content

Commit 5551161

Browse files
authored
feat(provider-generator): Skip definition attribute for aws_quicksight_analysis.definition data source (#3725)
- **feat(provider-generator): Skip definition attribute for aws_quicksight_analysis.definition data source as it produces too long names for Java to compile** - **chore(docs): Document skipped data source** - **chore(tests): Add test for skipping attribute type attributes**
1 parent 050ce84 commit 5551161

File tree

7 files changed

+82262
-22
lines changed

7 files changed

+82262
-22
lines changed

packages/@cdktf/provider-generator/lib/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap

Lines changed: 326 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,331 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`skips attributes in the disallow list: quicksight-template 1`] = `
3+
exports[`skips attribute type attributes in the disallow list: data-quicksight-analysis 1`] = `
4+
"// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis
5+
// generated from terraform resource schema
6+
7+
import { Construct } from 'constructs';
8+
import * as cdktf from 'cdktf';
9+
10+
// Configuration
11+
12+
export interface DataAwsQuicksightAnalysisConfig extends cdktf.TerraformMetaArguments {
13+
/**
14+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis#analysis_id DataAwsQuicksightAnalysis#analysis_id}
15+
*/
16+
readonly analysisId: string;
17+
/**
18+
* 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}
19+
*/
20+
readonly awsAccountId?: string;
21+
/**
22+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis#id DataAwsQuicksightAnalysis#id}
23+
*
24+
* Please be aware that the id field is automatically added to all resources in Terraform providers using a Terraform provider SDK version below 2.
25+
* 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.
26+
*/
27+
readonly id?: string;
28+
/**
29+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis#tags DataAwsQuicksightAnalysis#tags}
30+
*/
31+
readonly tags?: { [key: string]: string };
32+
}
33+
export interface DataAwsQuicksightAnalysisPermissions {
34+
}
35+
36+
export function dataAwsQuicksightAnalysisPermissionsToTerraform(struct?: DataAwsQuicksightAnalysisPermissions): any {
37+
if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(struct)) { return struct; }
38+
if (cdktf.isComplexElement(struct)) {
39+
throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration");
40+
}
41+
return {
42+
}
43+
}
44+
45+
46+
export function dataAwsQuicksightAnalysisPermissionsToHclTerraform(struct?: DataAwsQuicksightAnalysisPermissions): any {
47+
if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(struct)) { return struct; }
48+
if (cdktf.isComplexElement(struct)) {
49+
throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration");
50+
}
51+
const attrs = {
52+
};
53+
return attrs;
54+
}
55+
56+
export class DataAwsQuicksightAnalysisPermissionsOutputReference extends cdktf.ComplexObject {
57+
private isEmptyObject = false;
58+
59+
/**
60+
* @param terraformResource The parent resource
61+
* @param terraformAttribute The attribute on the parent resource this class is referencing
62+
* @param complexObjectIndex the index of this item in the list
63+
* @param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
64+
*/
65+
public constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean) {
66+
super(terraformResource, terraformAttribute, complexObjectIsFromSet, complexObjectIndex);
67+
}
68+
69+
public get internalValue(): DataAwsQuicksightAnalysisPermissions | undefined {
70+
let hasAnyValues = this.isEmptyObject;
71+
const internalValueResult: any = {};
72+
return hasAnyValues ? internalValueResult : undefined;
73+
}
74+
75+
public set internalValue(value: DataAwsQuicksightAnalysisPermissions | undefined) {
76+
if (value === undefined) {
77+
this.isEmptyObject = false;
78+
}
79+
else {
80+
this.isEmptyObject = Object.keys(value).length === 0;
81+
}
82+
}
83+
84+
// actions - computed: true, optional: false, required: false
85+
public get actions() {
86+
return cdktf.Fn.tolist(this.getListAttribute('actions'));
87+
}
88+
89+
// principal - computed: true, optional: false, required: false
90+
public get principal() {
91+
return this.getStringAttribute('principal');
92+
}
93+
}
94+
95+
export class DataAwsQuicksightAnalysisPermissionsList extends cdktf.ComplexList {
96+
97+
/**
98+
* @param terraformResource The parent resource
99+
* @param terraformAttribute The attribute on the parent resource this class is referencing
100+
* @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
101+
*/
102+
constructor(protected terraformResource: cdktf.IInterpolatingParent, protected terraformAttribute: string, protected wrapsSet: boolean) {
103+
super(terraformResource, terraformAttribute, wrapsSet)
104+
}
105+
106+
/**
107+
* @param index the index of the item to return
108+
*/
109+
public get(index: number): DataAwsQuicksightAnalysisPermissionsOutputReference {
110+
return new DataAwsQuicksightAnalysisPermissionsOutputReference(this.terraformResource, this.terraformAttribute, index, this.wrapsSet);
111+
}
112+
}
113+
114+
/**
115+
* Represents a {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis aws_quicksight_analysis}
116+
*/
117+
export class DataAwsQuicksightAnalysis extends cdktf.TerraformDataSource {
118+
119+
// =================
120+
// STATIC PROPERTIES
121+
// =================
122+
public static readonly tfResourceType = "aws_quicksight_analysis";
123+
124+
// ==============
125+
// STATIC Methods
126+
// ==============
127+
/**
128+
* Generates CDKTF code for importing a DataAwsQuicksightAnalysis resource upon running "cdktf plan <stack-name>"
129+
* @param scope The scope in which to define this construct
130+
* @param importToId The construct id used in the generated config for the DataAwsQuicksightAnalysis to import
131+
* @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
132+
* @param provider? Optional instance of the provider where the DataAwsQuicksightAnalysis to import is found
133+
*/
134+
public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider) {
135+
return new cdktf.ImportableResource(scope, importToId, { terraformResourceType: "aws_quicksight_analysis", importId: importFromId, provider });
136+
}
137+
138+
// ===========
139+
// INITIALIZER
140+
// ===========
141+
142+
/**
143+
* Create a new {@link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/quicksight_analysis aws_quicksight_analysis} Data Source
144+
*
145+
* @param scope The scope in which to define this construct
146+
* @param id The scoped construct ID. Must be unique amongst siblings in the same scope
147+
* @param options DataAwsQuicksightAnalysisConfig
148+
*/
149+
public constructor(scope: Construct, id: string, config: DataAwsQuicksightAnalysisConfig) {
150+
super(scope, id, {
151+
terraformResourceType: 'aws_quicksight_analysis',
152+
terraformGeneratorMetadata: {
153+
providerName: 'aws'
154+
},
155+
provider: config.provider,
156+
dependsOn: config.dependsOn,
157+
count: config.count,
158+
lifecycle: config.lifecycle,
159+
provisioners: config.provisioners,
160+
connection: config.connection,
161+
forEach: config.forEach
162+
});
163+
this._analysisId = config.analysisId;
164+
this._awsAccountId = config.awsAccountId;
165+
this._id = config.id;
166+
this._tags = config.tags;
167+
}
168+
169+
// ==========
170+
// ATTRIBUTES
171+
// ==========
172+
173+
// analysis_id - computed: false, optional: false, required: true
174+
private _analysisId?: string;
175+
public get analysisId() {
176+
return this.getStringAttribute('analysis_id');
177+
}
178+
public set analysisId(value: string) {
179+
this._analysisId = value;
180+
}
181+
// Temporarily expose input value. Use with caution.
182+
public get analysisIdInput() {
183+
return this._analysisId;
184+
}
185+
186+
// arn - computed: true, optional: false, required: false
187+
public get arn() {
188+
return this.getStringAttribute('arn');
189+
}
190+
191+
// aws_account_id - computed: true, optional: true, required: false
192+
private _awsAccountId?: string;
193+
public get awsAccountId() {
194+
return this.getStringAttribute('aws_account_id');
195+
}
196+
public set awsAccountId(value: string) {
197+
this._awsAccountId = value;
198+
}
199+
public resetAwsAccountId() {
200+
this._awsAccountId = undefined;
201+
}
202+
// Temporarily expose input value. Use with caution.
203+
public get awsAccountIdInput() {
204+
return this._awsAccountId;
205+
}
206+
207+
// created_time - computed: true, optional: false, required: false
208+
public get createdTime() {
209+
return this.getStringAttribute('created_time');
210+
}
211+
212+
// definition - computed: true, optional: false, required: false
213+
public get definition() {
214+
return this.interpolationForAttribute('definition');
215+
}
216+
217+
// id - computed: true, optional: true, required: false
218+
private _id?: string;
219+
public get id() {
220+
return this.getStringAttribute('id');
221+
}
222+
public set id(value: string) {
223+
this._id = value;
224+
}
225+
public resetId() {
226+
this._id = undefined;
227+
}
228+
// Temporarily expose input value. Use with caution.
229+
public get idInput() {
230+
return this._id;
231+
}
232+
233+
// last_published_time - computed: true, optional: false, required: false
234+
public get lastPublishedTime() {
235+
return this.getStringAttribute('last_published_time');
236+
}
237+
238+
// last_updated_time - computed: true, optional: false, required: false
239+
public get lastUpdatedTime() {
240+
return this.getStringAttribute('last_updated_time');
241+
}
242+
243+
// name - computed: true, optional: false, required: false
244+
public get name() {
245+
return this.getStringAttribute('name');
246+
}
247+
248+
// permissions - computed: true, optional: false, required: false
249+
private _permissions = new DataAwsQuicksightAnalysisPermissionsList(this, "permissions", false);
250+
public get permissions() {
251+
return this._permissions;
252+
}
253+
254+
// status - computed: true, optional: false, required: false
255+
public get status() {
256+
return this.getStringAttribute('status');
257+
}
258+
259+
// tags - computed: true, optional: true, required: false
260+
private _tags?: { [key: string]: string };
261+
public get tags() {
262+
return this.getStringMapAttribute('tags');
263+
}
264+
public set tags(value: { [key: string]: string }) {
265+
this._tags = value;
266+
}
267+
public resetTags() {
268+
this._tags = undefined;
269+
}
270+
// Temporarily expose input value. Use with caution.
271+
public get tagsInput() {
272+
return this._tags;
273+
}
274+
275+
// theme_arn - computed: true, optional: false, required: false
276+
public get themeArn() {
277+
return this.getStringAttribute('theme_arn');
278+
}
279+
280+
// =========
281+
// SYNTHESIS
282+
// =========
283+
284+
protected synthesizeAttributes(): { [name: string]: any } {
285+
return {
286+
analysis_id: cdktf.stringToTerraform(this._analysisId),
287+
aws_account_id: cdktf.stringToTerraform(this._awsAccountId),
288+
id: cdktf.stringToTerraform(this._id),
289+
tags: cdktf.hashMapper(cdktf.stringToTerraform)(this._tags),
290+
};
291+
}
292+
293+
protected synthesizeHclAttributes(): { [name: string]: any } {
294+
const attrs = {
295+
analysis_id: {
296+
value: cdktf.stringToHclTerraform(this._analysisId),
297+
isBlock: false,
298+
type: "simple",
299+
storageClassType: "string",
300+
},
301+
aws_account_id: {
302+
value: cdktf.stringToHclTerraform(this._awsAccountId),
303+
isBlock: false,
304+
type: "simple",
305+
storageClassType: "string",
306+
},
307+
id: {
308+
value: cdktf.stringToHclTerraform(this._id),
309+
isBlock: false,
310+
type: "simple",
311+
storageClassType: "string",
312+
},
313+
tags: {
314+
value: cdktf.hashMapperHcl(cdktf.stringToHclTerraform)(this._tags),
315+
isBlock: false,
316+
type: "map",
317+
storageClassType: "stringMap",
318+
},
319+
};
320+
321+
// remove undefined attributes
322+
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined ))
323+
}
324+
}
325+
"
326+
`;
327+
328+
exports[`skips block type attributes in the disallow list: quicksight-template 1`] = `
4329
"// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/quicksight_template
5330
// generated from terraform resource schema
6331

0 commit comments

Comments
 (0)