@cdktn/provider-generator 0.24.0-pre.9 → 0.24.0-pre.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.spec.swcrc +22 -0
- package/LICENSE +355 -0
- package/README.md +1 -1
- package/build/__tests__/edge-provider-schema/builder.d.ts +9 -3
- package/build/__tests__/edge-provider-schema/builder.js +6 -3
- package/build/__tests__/edge-provider-schema/cli.js +8 -3
- package/build/__tests__/edge-provider-schema/index.js +119 -1
- package/build/__tests__/provider.test.js +4 -1
- package/build/get/__tests__/generator/ephemeral-resources.test.d.ts +2 -0
- package/build/get/__tests__/generator/ephemeral-resources.test.js +49 -0
- package/build/get/__tests__/generator/module-generator.test.js +12 -12
- package/build/get/__tests__/generator/provider-functions.test.d.ts +2 -0
- package/build/get/__tests__/generator/provider-functions.test.js +176 -0
- package/build/get/__tests__/generator/provider-source-matching.test.d.ts +2 -0
- package/build/get/__tests__/generator/provider-source-matching.test.js +45 -0
- package/build/get/__tests__/generator/provider.test.js +9 -1
- package/build/get/__tests__/generator/supported-stored-classes.test.d.ts +2 -0
- package/build/get/__tests__/generator/supported-stored-classes.test.js +137 -0
- package/build/get/__tests__/generator/types.test.js +44 -1
- package/build/get/__tests__/generator/write-only.test.d.ts +2 -0
- package/build/get/__tests__/generator/write-only.test.js +65 -0
- package/build/get/__tests__/target-versions.test.d.ts +2 -0
- package/build/get/__tests__/target-versions.test.js +171 -0
- package/build/get/constructs-maker.d.ts +8 -1
- package/build/get/constructs-maker.js +46 -10
- package/build/get/generator/emitter/attributes-emitter.d.ts +13 -2
- package/build/get/generator/emitter/attributes-emitter.js +71 -5
- package/build/get/generator/emitter/index.d.ts +1 -0
- package/build/get/generator/emitter/index.js +2 -1
- package/build/get/generator/emitter/provider-functions-emitter.d.ts +11 -0
- package/build/get/generator/emitter/provider-functions-emitter.js +94 -0
- package/build/get/generator/emitter/resource-emitter.d.ts +5 -1
- package/build/get/generator/emitter/resource-emitter.js +83 -7
- package/build/get/generator/emitter/struct-emitter.js +10 -10
- package/build/get/generator/models/attribute-model.d.ts +4 -0
- package/build/get/generator/models/attribute-model.js +50 -4
- package/build/get/generator/models/attribute-type-model.d.ts +24 -0
- package/build/get/generator/models/attribute-type-model.js +91 -5
- package/build/get/generator/models/index.d.ts +1 -0
- package/build/get/generator/models/index.js +2 -1
- package/build/get/generator/models/provider-function-model.d.ts +102 -0
- package/build/get/generator/models/provider-function-model.js +667 -0
- package/build/get/generator/models/resource-model.d.ts +3 -0
- package/build/get/generator/models/resource-model.js +13 -4
- package/build/get/generator/models/struct.d.ts +2 -0
- package/build/get/generator/models/struct.js +6 -2
- package/build/get/generator/models/supported-stored-classes.d.ts +5 -0
- package/build/get/generator/models/supported-stored-classes.js +86 -0
- package/build/get/generator/module-generator.js +3 -3
- package/build/get/generator/provider-generator.d.ts +2 -0
- package/build/get/generator/provider-generator.js +41 -6
- package/build/get/generator/resource-parser.js +3 -1
- package/jest.config.js +16 -9
- package/package.json +28 -27
- package/package.sh +1 -1
- package/src/__tests__/__snapshots__/edge-provider-schema.test.ts.snap +4 -0
- package/src/__tests__/__snapshots__/provider.test.ts.snap +2828 -2828
- package/src/__tests__/edge-provider-schema/builder.ts +201 -0
- package/src/__tests__/edge-provider-schema/cli.ts +51 -0
- package/src/__tests__/edge-provider-schema/index.ts +284 -0
- package/src/__tests__/edge-provider-schema.test.ts +24 -0
- package/src/__tests__/provider.test.ts +183 -0
- package/src/get/__tests__/constructs-maker.test.ts +118 -0
- package/src/get/__tests__/generator/__snapshots__/complex-computed-types.test.ts.snap +5 -5
- package/src/get/__tests__/generator/__snapshots__/ephemeral-resources.test.ts.snap +524 -0
- package/src/get/__tests__/generator/__snapshots__/export-sharding.test.ts.snap +3310 -3310
- package/src/get/__tests__/generator/__snapshots__/module-generator.test.ts.snap +355 -355
- package/src/get/__tests__/generator/__snapshots__/nested-types.test.ts.snap +8 -8
- package/src/get/__tests__/generator/__snapshots__/provider-functions.test.ts.snap +444 -0
- package/src/get/__tests__/generator/__snapshots__/provider.test.ts.snap +8 -8
- package/src/get/__tests__/generator/__snapshots__/resource-types.test.ts.snap +126 -126
- package/src/get/__tests__/generator/__snapshots__/skipped-attributes.test.ts.snap +17 -17
- package/src/get/__tests__/generator/__snapshots__/types.test.ts.snap +201 -52
- package/src/get/__tests__/generator/__snapshots__/write-only.test.ts.snap +262 -0
- package/src/get/__tests__/generator/complex-computed-types.test.ts +28 -0
- package/src/get/__tests__/generator/deep-nested-attributes.test.ts +56 -0
- package/src/get/__tests__/generator/description-escaping.test.ts +84 -0
- package/src/get/__tests__/generator/empty-provider-resources.test.ts +26 -0
- package/src/get/__tests__/generator/ephemeral-resources.test.ts +46 -0
- package/src/get/__tests__/generator/export-sharding.test.ts +169 -0
- package/src/get/__tests__/generator/fixtures/deeply-nested-collections.test.fixture.json +129 -0
- package/src/get/__tests__/generator/fixtures/ephemeral-resources.test.fixture.json +160 -0
- package/src/get/__tests__/generator/fixtures/provider-functions-collision.test.fixture.json +31 -0
- package/src/get/__tests__/generator/fixtures/provider-functions-synthetic.test.fixture.json +192 -0
- package/src/get/__tests__/generator/fixtures/provider-functions.test.fixture.json +170 -0
- package/src/get/__tests__/generator/fixtures/write-only.test.fixture.json +58 -0
- package/src/get/__tests__/generator/import-style.test.ts +129 -0
- package/src/get/__tests__/generator/module-generator.test.ts +528 -0
- package/src/get/__tests__/generator/nested-types.test.ts +54 -0
- package/src/get/__tests__/generator/provider-functions.test.ts +262 -0
- package/src/get/__tests__/generator/provider-source-matching.test.ts +84 -0
- package/src/get/__tests__/generator/provider.test.ts +59 -0
- package/src/get/__tests__/generator/resource-types.test.ts +118 -0
- package/src/get/__tests__/generator/skipped-attributes.test.ts +72 -0
- package/src/get/__tests__/generator/supported-stored-classes.test.ts +147 -0
- package/src/get/__tests__/generator/types.test.ts +686 -0
- package/src/get/__tests__/generator/versions-file.test.ts +72 -0
- package/src/get/__tests__/generator/write-only.test.ts +71 -0
- package/src/get/__tests__/target-versions.test.ts +206 -0
- package/src/get/__tests__/util.ts +75 -0
- package/src/get/constructs-maker.ts +885 -0
- package/src/get/generator/custom-defaults.ts +493 -0
- package/src/get/generator/emitter/attributes-emitter.ts +316 -0
- package/src/get/generator/emitter/index.ts +6 -0
- package/src/get/generator/emitter/provider-functions-emitter.ts +117 -0
- package/src/get/generator/emitter/resource-emitter.ts +330 -0
- package/src/get/generator/emitter/struct-emitter.ts +683 -0
- package/src/get/generator/loop-detection.ts +81 -0
- package/src/get/generator/models/attribute-model.ts +273 -0
- package/src/get/generator/models/attribute-type-model.ts +560 -0
- package/src/get/generator/models/index.ts +8 -0
- package/src/get/generator/models/provider-function-model.ts +872 -0
- package/src/get/generator/models/resource-model.ts +183 -0
- package/src/get/generator/models/scope.ts +54 -0
- package/src/get/generator/models/struct.ts +124 -0
- package/src/get/generator/models/supported-stored-classes.ts +88 -0
- package/src/get/generator/module-generator.ts +234 -0
- package/src/get/generator/provider-generator.ts +428 -0
- package/src/get/generator/resource-parser.ts +764 -0
- package/src/get/generator/sanitized-comments.ts +49 -0
- package/src/get/generator/skipped-attributes.ts +27 -0
- package/src/index.ts +40 -0
- package/src/util.ts +26 -0
- package/tsconfig.json +1 -2
|
@@ -29,7 +29,7 @@ export interface NestedTypeWithoutAttributesResourcePredictorBotDetection {
|
|
|
29
29
|
export function nestedTypeWithoutAttributesResourcePredictorBotDetectionToTerraform(struct?: NestedTypeWithoutAttributesResourcePredictorBotDetection | cdktn.IResolvable): any {
|
|
30
30
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
31
31
|
if (cdktn.isComplexElement(struct)) {
|
|
32
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
32
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
}
|
|
@@ -39,7 +39,7 @@ export function nestedTypeWithoutAttributesResourcePredictorBotDetectionToTerraf
|
|
|
39
39
|
export function nestedTypeWithoutAttributesResourcePredictorBotDetectionToHclTerraform(struct?: NestedTypeWithoutAttributesResourcePredictorBotDetection | cdktn.IResolvable): any {
|
|
40
40
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
41
41
|
if (cdktn.isComplexElement(struct)) {
|
|
42
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
42
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
43
43
|
}
|
|
44
44
|
const attrs = {
|
|
45
45
|
};
|
|
@@ -250,7 +250,7 @@ export interface NestedTypesResourceArchiveRulesFilter {
|
|
|
250
250
|
export function nestedTypesResourceArchiveRulesFilterToTerraform(struct?: NestedTypesResourceArchiveRulesFilter | cdktn.IResolvable): any {
|
|
251
251
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
252
252
|
if (cdktn.isComplexElement(struct)) {
|
|
253
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
253
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
254
254
|
}
|
|
255
255
|
return {
|
|
256
256
|
eq: cdktn.listMapper(cdktn.stringToTerraform, false)(struct!.eq),
|
|
@@ -263,7 +263,7 @@ export function nestedTypesResourceArchiveRulesFilterToTerraform(struct?: Nested
|
|
|
263
263
|
export function nestedTypesResourceArchiveRulesFilterToHclTerraform(struct?: NestedTypesResourceArchiveRulesFilter | cdktn.IResolvable): any {
|
|
264
264
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
265
265
|
if (cdktn.isComplexElement(struct)) {
|
|
266
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
266
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
267
267
|
}
|
|
268
268
|
const attrs = {
|
|
269
269
|
eq: {
|
|
@@ -401,7 +401,7 @@ export class NestedTypesResourceArchiveRulesFilterList extends cdktn.ComplexList
|
|
|
401
401
|
* @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
|
|
402
402
|
*/
|
|
403
403
|
constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean) {
|
|
404
|
-
super(terraformResource, terraformAttribute, wrapsSet)
|
|
404
|
+
super(terraformResource, terraformAttribute, wrapsSet);
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
/**
|
|
@@ -427,7 +427,7 @@ export interface NestedTypesResourceArchiveRules {
|
|
|
427
427
|
export function nestedTypesResourceArchiveRulesToTerraform(struct?: NestedTypesResourceArchiveRules | cdktn.IResolvable): any {
|
|
428
428
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
429
429
|
if (cdktn.isComplexElement(struct)) {
|
|
430
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
430
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
431
431
|
}
|
|
432
432
|
return {
|
|
433
433
|
filter: cdktn.listMapper(nestedTypesResourceArchiveRulesFilterToTerraform, false)(struct!.filter),
|
|
@@ -439,7 +439,7 @@ export function nestedTypesResourceArchiveRulesToTerraform(struct?: NestedTypesR
|
|
|
439
439
|
export function nestedTypesResourceArchiveRulesToHclTerraform(struct?: NestedTypesResourceArchiveRules | cdktn.IResolvable): any {
|
|
440
440
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
441
441
|
if (cdktn.isComplexElement(struct)) {
|
|
442
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
442
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
443
443
|
}
|
|
444
444
|
const attrs = {
|
|
445
445
|
filter: {
|
|
@@ -546,7 +546,7 @@ export class NestedTypesResourceArchiveRulesList extends cdktn.ComplexList {
|
|
|
546
546
|
* @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
|
|
547
547
|
*/
|
|
548
548
|
constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean) {
|
|
549
|
-
super(terraformResource, terraformAttribute, wrapsSet)
|
|
549
|
+
super(terraformResource, terraformAttribute, wrapsSet);
|
|
550
550
|
}
|
|
551
551
|
|
|
552
552
|
/**
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
+
|
|
3
|
+
exports[`generate provider functions covering variadic parameters, primitive/list returns, and a 'default' parameter name matches the snapshot: example-provider-functions 1`] = `
|
|
4
|
+
"// generated from provider function schema
|
|
5
|
+
|
|
6
|
+
import * as cdktn from 'cdktn';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Provider-defined functions of the example provider.
|
|
10
|
+
*/
|
|
11
|
+
export class ExampleProviderFunctions {
|
|
12
|
+
private readonly providerLocalName: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param providerLocalName The local name of the provider in required_providers; defaults to the registry short name. Override when the provider is declared under a different local name — aliases do not change the namespace, local names do.
|
|
16
|
+
*/
|
|
17
|
+
constructor(providerLocalName: string) {
|
|
18
|
+
this.providerLocalName = providerLocalName;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns an object describing the build that produced the given seed.
|
|
23
|
+
* @param {string} seed
|
|
24
|
+
* @returns {object}
|
|
25
|
+
*/
|
|
26
|
+
public buildInfo(seed: string): cdktn.IResolvable {
|
|
27
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "build_info", [seed]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns true_value if condition is true, otherwise returns false_value. The dynamic return type allows either branch to be a value of any type.
|
|
32
|
+
* @param {boolean | IResolvable} condition
|
|
33
|
+
* @param {any} trueValue
|
|
34
|
+
* @param {any} falseValue
|
|
35
|
+
* @returns {any}
|
|
36
|
+
*/
|
|
37
|
+
public conditionIf(condition: boolean | cdktn.IResolvable, trueValue: any, falseValue: any): cdktn.IResolvable {
|
|
38
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "condition_if", [condition, trueValue, falseValue]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Renders the given map of config objects as a single string.
|
|
43
|
+
* @param {any} configs
|
|
44
|
+
* @returns {string}
|
|
45
|
+
*/
|
|
46
|
+
public configMap(configs: any): string {
|
|
47
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "config_map", [configs]));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns a map of config objects keyed by tag for the given prefix.
|
|
52
|
+
* @param {string} prefix
|
|
53
|
+
* @returns {{ [key: string]: any }}
|
|
54
|
+
*/
|
|
55
|
+
public configsByTag(prefix: string): { [key: string]: any } {
|
|
56
|
+
return cdktn.Token.asAnyMap(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "configs_by_tag", [prefix]));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Returns a map of counts keyed by tag for the given prefix.
|
|
61
|
+
* @param {string} prefix
|
|
62
|
+
* @returns {{ [key: string]: number }}
|
|
63
|
+
*/
|
|
64
|
+
public countByTag(prefix: string): { [key: string]: number } {
|
|
65
|
+
return cdktn.Token.asNumberMap(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "count_by_tag", [prefix]));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Deduplicates each group of names, returning a list of name sets.
|
|
70
|
+
* @param {Array<Set<string>>} nameGroups
|
|
71
|
+
* @returns {Array<Set<string>>}
|
|
72
|
+
*/
|
|
73
|
+
public dedupeNameGroups(nameGroups: string[][] | cdktn.IResolvable): cdktn.IResolvable {
|
|
74
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "dedupe_name_groups", [nameGroups]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Returns a default map of string tags derived from the given prefix - used to prove a map(string) RETURN can be fed directly into another function's map(string) PARAMETER (see tag_map above).
|
|
79
|
+
* @param {string} prefix
|
|
80
|
+
* @returns {{ [key: string]: string }}
|
|
81
|
+
*/
|
|
82
|
+
public defaultTags(prefix: string): { [key: string]: string } {
|
|
83
|
+
return cdktn.Token.asStringMap(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "default_tags", [prefix]));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Renders the given list of config objects as a single string.
|
|
88
|
+
* @param {Array<object>} configs
|
|
89
|
+
* @returns {string}
|
|
90
|
+
*/
|
|
91
|
+
public describeConfigs(configs: any[] | cdktn.IResolvable): string {
|
|
92
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "describe_configs", [configs]));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns true if any flag in the given set of flags is true.
|
|
97
|
+
* @param {Set<boolean | IResolvable>} flags - Terraform set; ordering is not guaranteed and duplicate values are removed.
|
|
98
|
+
* @returns {boolean | IResolvable}
|
|
99
|
+
*/
|
|
100
|
+
public flagSet(flags: Array<boolean | cdktn.IResolvable> | cdktn.IResolvable): cdktn.IResolvable {
|
|
101
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "flag_set", [flags]);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Returns a map of flags keyed by tag for the given prefix.
|
|
106
|
+
* @param {string} prefix
|
|
107
|
+
* @returns {{ [key: string]: boolean }}
|
|
108
|
+
*/
|
|
109
|
+
public flagsByTag(prefix: string): { [key: string]: boolean } {
|
|
110
|
+
return cdktn.Token.asBooleanMap(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "flags_by_tag", [prefix]));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Returns a set of flags derived from the given seed - used to prove a set(bool) RETURN can be fed directly into another function's set(bool) PARAMETER (see flag_set above).
|
|
115
|
+
* @param {string} seed
|
|
116
|
+
* @returns {Set<boolean | IResolvable>} Terraform set; ordering is not guaranteed and duplicate values are removed.
|
|
117
|
+
*/
|
|
118
|
+
public flagsForSeed(seed: string): cdktn.IResolvable {
|
|
119
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "flags_for_seed", [seed]);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Returns true if any flag in the given ordered list of flags is true.
|
|
124
|
+
* @param {Array<boolean | IResolvable>} flags
|
|
125
|
+
* @returns {boolean | IResolvable}
|
|
126
|
+
*/
|
|
127
|
+
public flagsOrdered(flags: Array<boolean | cdktn.IResolvable> | cdktn.IResolvable): cdktn.IResolvable {
|
|
128
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "flags_ordered", [flags]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Joins the given strings together using the provided separator.
|
|
133
|
+
* @param {string} separator
|
|
134
|
+
* @param {Array<string>} values
|
|
135
|
+
* @returns {string}
|
|
136
|
+
*/
|
|
137
|
+
public joinStrings(separator: string, values: Array<string>): string {
|
|
138
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "join_strings", [separator, ...values]));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* A deprecated helper kept around for backwards compatibility.
|
|
143
|
+
* @deprecated Use new_helper instead.
|
|
144
|
+
* @param {string} input
|
|
145
|
+
* @returns {string}
|
|
146
|
+
*/
|
|
147
|
+
public legacyHelper(input: string): string {
|
|
148
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "legacy_helper", [input]));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Returns a list of numbers counting up from 1 to the given count.
|
|
153
|
+
* @param {number} count
|
|
154
|
+
* @returns {Array<number>}
|
|
155
|
+
*/
|
|
156
|
+
public listNumbers(count: number): number[] {
|
|
157
|
+
return cdktn.Token.asNumberList(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "list_numbers", [count]));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Returns a list of names prefixed with the given prefix.
|
|
162
|
+
* @param {string} prefix
|
|
163
|
+
* @returns {Array<string>}
|
|
164
|
+
*/
|
|
165
|
+
public listPrefixedNames(prefix: string): string[] {
|
|
166
|
+
return cdktn.Token.asList(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "list_prefixed_names", [prefix]));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Joins a possibly-null prefix with a required suffix.
|
|
171
|
+
* @param {string | IResolvable} prefix - Pass cdktn.Token.nullValue() for an explicit Terraform null.
|
|
172
|
+
* @param {string} suffix
|
|
173
|
+
* @returns {string}
|
|
174
|
+
*/
|
|
175
|
+
public midNullable(prefix: string | cdktn.IResolvable, suffix: string): string {
|
|
176
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "mid_nullable", [prefix, suffix]));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Flattens a matrix (a list of lists of strings) into a single string.
|
|
181
|
+
* @param {Array<Array<string>>} matrix
|
|
182
|
+
* @returns {string}
|
|
183
|
+
*/
|
|
184
|
+
public nestedList(matrix: string[][] | cdktn.IResolvable): string {
|
|
185
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "nested_list", [matrix]));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Adds up a default starting value and any number of addends.
|
|
190
|
+
* @param {number} defaultValue
|
|
191
|
+
* @param {Array<number>} addends
|
|
192
|
+
* @returns {number}
|
|
193
|
+
*/
|
|
194
|
+
public sum(defaultValue: number, addends: Array<number>): number {
|
|
195
|
+
return cdktn.Token.asNumber(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "sum", [defaultValue, ...addends]));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Renders the given map of string tags as a single string.
|
|
200
|
+
* @param {{ [key: string]: string }} tags
|
|
201
|
+
* @returns {string}
|
|
202
|
+
*/
|
|
203
|
+
public tagMap(tags: { [key: string]: string }): string {
|
|
204
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "tag_map", [tags]));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Greets the given name, optionally with a custom greeting.
|
|
209
|
+
* @param {string} name
|
|
210
|
+
* @param {string | IResolvable} greeting - Omit or pass cdktn.Token.nullValue() to render the Terraform null keyword.
|
|
211
|
+
* @returns {string}
|
|
212
|
+
*/
|
|
213
|
+
public trailingNullable(name: string, greeting?: string | cdktn.IResolvable): string {
|
|
214
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "trailing_nullable", [name, greeting]));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Returns the distinct name lists among the given ones.
|
|
219
|
+
* @param {Set<Array<string>>} nameLists - Terraform set; ordering is not guaranteed and duplicate values are removed.
|
|
220
|
+
* @returns {Set<Array<string>>} Terraform set; ordering is not guaranteed and duplicate values are removed.
|
|
221
|
+
*/
|
|
222
|
+
public uniqueNameLists(nameLists: string[][] | cdktn.IResolvable): cdktn.IResolvable {
|
|
223
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "unique_name_lists", [nameLists]);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Joins a label with any number of possibly-null items.
|
|
228
|
+
* @param {string} label
|
|
229
|
+
* @param {Array<string | IResolvable>} items - Pass cdktn.Token.nullValue() for an explicit Terraform null.
|
|
230
|
+
* @returns {string}
|
|
231
|
+
*/
|
|
232
|
+
public variadicNullable(label: string, items: Array<string | cdktn.IResolvable>): string {
|
|
233
|
+
return cdktn.Token.asString(cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "variadic_nullable", [label, ...items]));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
"
|
|
237
|
+
`;
|
|
238
|
+
|
|
239
|
+
exports[`generate provider functions covering variadic parameters, primitive/list returns, and a 'default' parameter name matches the snapshot: provider-index 1`] = `
|
|
240
|
+
"// generated by cdktn get
|
|
241
|
+
export * as providerFunctions from './provider-functions/index';
|
|
242
|
+
|
|
243
|
+
"
|
|
244
|
+
`;
|
|
245
|
+
|
|
246
|
+
exports[`generate provider functions covering variadic parameters, primitive/list returns, and a 'default' parameter name matches the snapshot: provider-lazy-index 1`] = `
|
|
247
|
+
"// generated by cdktn get
|
|
248
|
+
Object.defineProperty(exports, 'providerFunctions', { get: function () { return require('./provider-functions'); } });
|
|
249
|
+
|
|
250
|
+
"
|
|
251
|
+
`;
|
|
252
|
+
|
|
253
|
+
exports[`generate provider functions for the time provider (real terraform 1.15.6 schema fragment): provider-index 1`] = `
|
|
254
|
+
"// generated by cdktn get
|
|
255
|
+
export * as staticResource from './static-resource/index';
|
|
256
|
+
export * as provider from './provider/index';
|
|
257
|
+
export * as providerFunctions from './provider-functions/index';
|
|
258
|
+
|
|
259
|
+
"
|
|
260
|
+
`;
|
|
261
|
+
|
|
262
|
+
exports[`generate provider functions for the time provider (real terraform 1.15.6 schema fragment): provider-lazy-index 1`] = `
|
|
263
|
+
"// generated by cdktn get
|
|
264
|
+
Object.defineProperty(exports, 'staticResource', { get: function () { return require('./static-resource'); } });
|
|
265
|
+
Object.defineProperty(exports, 'provider', { get: function () { return require('./provider'); } });
|
|
266
|
+
Object.defineProperty(exports, 'providerFunctions', { get: function () { return require('./provider-functions'); } });
|
|
267
|
+
|
|
268
|
+
"
|
|
269
|
+
`;
|
|
270
|
+
|
|
271
|
+
exports[`generate provider functions for the time provider (real terraform 1.15.6 schema fragment): time-provider 1`] = `
|
|
272
|
+
"// https://registry.terraform.io/providers/hashicorp/time/latest/docs
|
|
273
|
+
// generated from terraform resource schema
|
|
274
|
+
|
|
275
|
+
import { Construct } from 'constructs';
|
|
276
|
+
import * as cdktn from 'cdktn';
|
|
277
|
+
|
|
278
|
+
// Configuration
|
|
279
|
+
|
|
280
|
+
export interface TimeProviderConfig {
|
|
281
|
+
/**
|
|
282
|
+
* Alias name
|
|
283
|
+
*
|
|
284
|
+
* Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/time/latest/docs#alias TimeProvider#alias}
|
|
285
|
+
*/
|
|
286
|
+
readonly alias?: string;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
import { TimeProviderFunctions } from '../provider-functions/index';
|
|
290
|
+
/**
|
|
291
|
+
* Represents a {@link https://registry.terraform.io/providers/hashicorp/time/latest/docs time}
|
|
292
|
+
*/
|
|
293
|
+
export class TimeProvider extends cdktn.TerraformProvider {
|
|
294
|
+
|
|
295
|
+
// =================
|
|
296
|
+
// STATIC PROPERTIES
|
|
297
|
+
// =================
|
|
298
|
+
public static readonly tfResourceType = "time";
|
|
299
|
+
|
|
300
|
+
// ==============
|
|
301
|
+
// STATIC Methods
|
|
302
|
+
// ==============
|
|
303
|
+
/**
|
|
304
|
+
* Generates CDKTN code for importing a TimeProvider resource upon running "cdktn plan <stack-name>"
|
|
305
|
+
* @param scope The scope in which to define this construct
|
|
306
|
+
* @param importToId The construct id used in the generated config for the TimeProvider to import
|
|
307
|
+
* @param importFromId The id of the existing TimeProvider that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/time/latest/docs#import import section} in the documentation of this resource for the id to use
|
|
308
|
+
* @param provider? Optional instance of the provider where the TimeProvider to import is found
|
|
309
|
+
*/
|
|
310
|
+
public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktn.TerraformProvider) {
|
|
311
|
+
return new cdktn.ImportableResource(scope, importToId, { terraformResourceType: "time", importId: importFromId, provider });
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// ===========
|
|
315
|
+
// INITIALIZER
|
|
316
|
+
// ===========
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Create a new {@link https://registry.terraform.io/providers/hashicorp/time/latest/docs time} Resource
|
|
320
|
+
*
|
|
321
|
+
* @param scope The scope in which to define this construct
|
|
322
|
+
* @param id The scoped construct ID. Must be unique amongst siblings in the same scope
|
|
323
|
+
* @param options TimeProviderConfig = {}
|
|
324
|
+
*/
|
|
325
|
+
public constructor(scope: Construct, id: string, config: TimeProviderConfig = {}) {
|
|
326
|
+
super(scope, id, {
|
|
327
|
+
terraformResourceType: 'time',
|
|
328
|
+
terraformGeneratorMetadata: {
|
|
329
|
+
providerName: 'time'
|
|
330
|
+
},
|
|
331
|
+
terraformProviderSource: 'registry.terraform.io/hashicorp/time'
|
|
332
|
+
});
|
|
333
|
+
this._alias = config.alias;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// ==========
|
|
337
|
+
// ATTRIBUTES
|
|
338
|
+
// ==========
|
|
339
|
+
|
|
340
|
+
// alias - computed: false, optional: true, required: false
|
|
341
|
+
private _alias?: string;
|
|
342
|
+
public get alias() {
|
|
343
|
+
return this._alias;
|
|
344
|
+
}
|
|
345
|
+
public set alias(value: string | undefined) {
|
|
346
|
+
this._alias = value;
|
|
347
|
+
}
|
|
348
|
+
public resetAlias() {
|
|
349
|
+
this._alias = undefined;
|
|
350
|
+
}
|
|
351
|
+
// Temporarily expose input value. Use with caution.
|
|
352
|
+
public get aliasInput() {
|
|
353
|
+
return this._alias;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// ==========================
|
|
357
|
+
// PROVIDER-DEFINED FUNCTIONS
|
|
358
|
+
// ==========================
|
|
359
|
+
private _functions?: TimeProviderFunctions;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Provider-defined functions of the time provider.
|
|
363
|
+
*/
|
|
364
|
+
public get functions(): TimeProviderFunctions {
|
|
365
|
+
if (!this._functions) {
|
|
366
|
+
this._functions = new TimeProviderFunctions(this.terraformResourceType);
|
|
367
|
+
}
|
|
368
|
+
return this._functions;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// =========
|
|
372
|
+
// SYNTHESIS
|
|
373
|
+
// =========
|
|
374
|
+
|
|
375
|
+
protected synthesizeAttributes(): { [name: string]: any } {
|
|
376
|
+
return {
|
|
377
|
+
alias: cdktn.stringToTerraform(this._alias),
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
protected synthesizeHclAttributes(): { [name: string]: any } {
|
|
382
|
+
const attrs = {
|
|
383
|
+
alias: {
|
|
384
|
+
value: cdktn.stringToHclTerraform(this._alias),
|
|
385
|
+
isBlock: false,
|
|
386
|
+
type: "simple",
|
|
387
|
+
storageClassType: "string",
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// remove undefined attributes
|
|
392
|
+
return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined ))
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
"
|
|
396
|
+
`;
|
|
397
|
+
|
|
398
|
+
exports[`generate provider functions for the time provider (real terraform 1.15.6 schema fragment): time-provider-functions 1`] = `
|
|
399
|
+
"// generated from provider function schema
|
|
400
|
+
|
|
401
|
+
import * as cdktn from 'cdktn';
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Provider-defined functions of the time provider.
|
|
405
|
+
*/
|
|
406
|
+
export class TimeProviderFunctions {
|
|
407
|
+
private readonly providerLocalName: string;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* @param providerLocalName The local name of the provider in required_providers; defaults to the registry short name. Override when the provider is declared under a different local name — aliases do not change the namespace, local names do.
|
|
411
|
+
*/
|
|
412
|
+
constructor(providerLocalName: string) {
|
|
413
|
+
this.providerLocalName = providerLocalName;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Given a [Go duration string](https://pkg.go.dev/time#ParseDuration), will parse and return an object representation of that duration.
|
|
418
|
+
* @param {string} duration - Go time package duration string to parse
|
|
419
|
+
* @returns {object}
|
|
420
|
+
*/
|
|
421
|
+
public durationParse(duration: string): cdktn.IResolvable {
|
|
422
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "duration_parse", [duration]);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Given an RFC3339 timestamp string, will parse and return an object representation of that date and time.
|
|
427
|
+
* @param {string} timestamp - RFC3339 timestamp string to parse
|
|
428
|
+
* @returns {object}
|
|
429
|
+
*/
|
|
430
|
+
public rfc3339Parse(timestamp: string): cdktn.IResolvable {
|
|
431
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "rfc3339_parse", [timestamp]);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Given a unix timestamp integer, will parse and return an object representation of that date and time. A unix timestamp is the number of seconds elapsed since January 1, 1970 UTC.
|
|
436
|
+
* @param {number} unixTimestamp - Unix Timestamp integer to parse
|
|
437
|
+
* @returns {object}
|
|
438
|
+
*/
|
|
439
|
+
public unixTimestampParse(unixTimestamp: number): cdktn.IResolvable {
|
|
440
|
+
return cdktn.TerraformProviderFunction.invoke(this.providerLocalName, "unix_timestamp_parse", [unixTimestamp]);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
"
|
|
444
|
+
`;
|
|
@@ -166,7 +166,7 @@ export interface AwsProviderAssumeRole {
|
|
|
166
166
|
export function awsProviderAssumeRoleToTerraform(struct?: AwsProviderAssumeRole): any {
|
|
167
167
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
168
168
|
if (cdktn.isComplexElement(struct)) {
|
|
169
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
169
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
170
170
|
}
|
|
171
171
|
return {
|
|
172
172
|
external_id: cdktn.stringToTerraform(struct!.externalId),
|
|
@@ -180,7 +180,7 @@ export function awsProviderAssumeRoleToTerraform(struct?: AwsProviderAssumeRole)
|
|
|
180
180
|
export function awsProviderAssumeRoleToHclTerraform(struct?: AwsProviderAssumeRole): any {
|
|
181
181
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
182
182
|
if (cdktn.isComplexElement(struct)) {
|
|
183
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
183
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
184
184
|
}
|
|
185
185
|
const attrs = {
|
|
186
186
|
external_id: {
|
|
@@ -1029,7 +1029,7 @@ export interface AwsProviderEndpoints {
|
|
|
1029
1029
|
export function awsProviderEndpointsToTerraform(struct?: AwsProviderEndpoints | cdktn.IResolvable): any {
|
|
1030
1030
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
1031
1031
|
if (cdktn.isComplexElement(struct)) {
|
|
1032
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
1032
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
1033
1033
|
}
|
|
1034
1034
|
return {
|
|
1035
1035
|
accessanalyzer: cdktn.stringToTerraform(struct!.accessanalyzer),
|
|
@@ -1174,7 +1174,7 @@ export function awsProviderEndpointsToTerraform(struct?: AwsProviderEndpoints |
|
|
|
1174
1174
|
export function awsProviderEndpointsToHclTerraform(struct?: AwsProviderEndpoints | cdktn.IResolvable): any {
|
|
1175
1175
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
1176
1176
|
if (cdktn.isComplexElement(struct)) {
|
|
1177
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
1177
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
1178
1178
|
}
|
|
1179
1179
|
const attrs = {
|
|
1180
1180
|
accessanalyzer: {
|
|
@@ -2011,7 +2011,7 @@ export interface AwsProviderIgnoreTags {
|
|
|
2011
2011
|
export function awsProviderIgnoreTagsToTerraform(struct?: AwsProviderIgnoreTags): any {
|
|
2012
2012
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
2013
2013
|
if (cdktn.isComplexElement(struct)) {
|
|
2014
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
2014
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
2015
2015
|
}
|
|
2016
2016
|
return {
|
|
2017
2017
|
key_prefixes: cdktn.listMapper(cdktn.stringToTerraform, false)(struct!.keyPrefixes),
|
|
@@ -2023,7 +2023,7 @@ export function awsProviderIgnoreTagsToTerraform(struct?: AwsProviderIgnoreTags)
|
|
|
2023
2023
|
export function awsProviderIgnoreTagsToHclTerraform(struct?: AwsProviderIgnoreTags): any {
|
|
2024
2024
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
2025
2025
|
if (cdktn.isComplexElement(struct)) {
|
|
2026
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
2026
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
2027
2027
|
}
|
|
2028
2028
|
const attrs = {
|
|
2029
2029
|
key_prefixes: {
|
|
@@ -2686,7 +2686,7 @@ export interface ElasticstackProviderElasticsearch {
|
|
|
2686
2686
|
export function elasticstackProviderElasticsearchToTerraform(struct?: ElasticstackProviderElasticsearch): any {
|
|
2687
2687
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
2688
2688
|
if (cdktn.isComplexElement(struct)) {
|
|
2689
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
2689
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
2690
2690
|
}
|
|
2691
2691
|
return {
|
|
2692
2692
|
api_key: cdktn.stringToTerraform(struct!.apiKey),
|
|
@@ -2707,7 +2707,7 @@ export function elasticstackProviderElasticsearchToTerraform(struct?: Elasticsta
|
|
|
2707
2707
|
export function elasticstackProviderElasticsearchToHclTerraform(struct?: ElasticstackProviderElasticsearch): any {
|
|
2708
2708
|
if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }
|
|
2709
2709
|
if (cdktn.isComplexElement(struct)) {
|
|
2710
|
-
throw new Error("A complex element was used as configuration, this is not supported: https://
|
|
2710
|
+
throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");
|
|
2711
2711
|
}
|
|
2712
2712
|
const attrs = {
|
|
2713
2713
|
api_key: {
|