@azure/arm-resourcesbicep 1.0.0-alpha.20250910.1
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/browser/api/bicepContext.d.ts +19 -0
- package/dist/browser/api/bicepContext.js +38 -0
- package/dist/browser/api/bicepContext.js.map +1 -0
- package/dist/browser/api/decompileOperationGroup/index.d.ts +3 -0
- package/dist/browser/api/decompileOperationGroup/index.js +4 -0
- package/dist/browser/api/decompileOperationGroup/index.js.map +1 -0
- package/dist/browser/api/decompileOperationGroup/operations.d.ts +9 -0
- package/dist/browser/api/decompileOperationGroup/operations.js +37 -0
- package/dist/browser/api/decompileOperationGroup/operations.js.map +1 -0
- package/dist/browser/api/decompileOperationGroup/options.d.ts +5 -0
- package/dist/browser/api/decompileOperationGroup/options.js +4 -0
- package/dist/browser/api/decompileOperationGroup/options.js.map +1 -0
- package/dist/browser/api/index.d.ts +2 -0
- package/dist/browser/api/index.js +4 -0
- package/dist/browser/api/index.js.map +1 -0
- package/dist/browser/bicepClient.d.ts +15 -0
- package/dist/browser/bicepClient.js +25 -0
- package/dist/browser/bicepClient.js.map +1 -0
- package/dist/browser/classic/decompileOperationGroup/index.d.ts +10 -0
- package/dist/browser/classic/decompileOperationGroup/index.js +14 -0
- package/dist/browser/classic/decompileOperationGroup/index.js.map +1 -0
- package/dist/browser/classic/index.d.ts +2 -0
- package/dist/browser/classic/index.js +4 -0
- package/dist/browser/classic/index.js.map +1 -0
- package/dist/browser/index.d.ts +6 -0
- package/dist/browser/index.js +5 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/logger.d.ts +2 -0
- package/dist/browser/logger.js +5 -0
- package/dist/browser/logger.js.map +1 -0
- package/dist/browser/models/index.d.ts +2 -0
- package/dist/browser/models/index.js +4 -0
- package/dist/browser/models/index.js.map +1 -0
- package/dist/browser/models/models.d.ts +59 -0
- package/dist/browser/models/models.js +61 -0
- package/dist/browser/models/models.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/browser/static-helpers/urlTemplate.js +169 -0
- package/dist/browser/static-helpers/urlTemplate.js.map +1 -0
- package/dist/commonjs/api/bicepContext.d.ts +19 -0
- package/dist/commonjs/api/bicepContext.js +41 -0
- package/dist/commonjs/api/bicepContext.js.map +1 -0
- package/dist/commonjs/api/decompileOperationGroup/index.d.ts +3 -0
- package/dist/commonjs/api/decompileOperationGroup/index.js +8 -0
- package/dist/commonjs/api/decompileOperationGroup/index.js.map +1 -0
- package/dist/commonjs/api/decompileOperationGroup/operations.d.ts +9 -0
- package/dist/commonjs/api/decompileOperationGroup/operations.js +42 -0
- package/dist/commonjs/api/decompileOperationGroup/operations.js.map +1 -0
- package/dist/commonjs/api/decompileOperationGroup/options.d.ts +5 -0
- package/dist/commonjs/api/decompileOperationGroup/options.js +5 -0
- package/dist/commonjs/api/decompileOperationGroup/options.js.map +1 -0
- package/dist/commonjs/api/index.d.ts +2 -0
- package/dist/commonjs/api/index.js +8 -0
- package/dist/commonjs/api/index.js.map +1 -0
- package/dist/commonjs/bicepClient.d.ts +15 -0
- package/dist/commonjs/bicepClient.js +29 -0
- package/dist/commonjs/bicepClient.js.map +1 -0
- package/dist/commonjs/classic/decompileOperationGroup/index.d.ts +10 -0
- package/dist/commonjs/classic/decompileOperationGroup/index.js +17 -0
- package/dist/commonjs/classic/decompileOperationGroup/index.js.map +1 -0
- package/dist/commonjs/classic/index.d.ts +2 -0
- package/dist/commonjs/classic/index.js +5 -0
- package/dist/commonjs/classic/index.js.map +1 -0
- package/dist/commonjs/index.d.ts +6 -0
- package/dist/commonjs/index.js +10 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/logger.d.ts +2 -0
- package/dist/commonjs/logger.js +8 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +2 -0
- package/dist/commonjs/models/index.js +8 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/models/models.d.ts +59 -0
- package/dist/commonjs/models/models.js +73 -0
- package/dist/commonjs/models/models.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/commonjs/static-helpers/urlTemplate.js +172 -0
- package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/api/bicepContext.d.ts +19 -0
- package/dist/esm/api/bicepContext.js +38 -0
- package/dist/esm/api/bicepContext.js.map +1 -0
- package/dist/esm/api/decompileOperationGroup/index.d.ts +3 -0
- package/dist/esm/api/decompileOperationGroup/index.js +4 -0
- package/dist/esm/api/decompileOperationGroup/index.js.map +1 -0
- package/dist/esm/api/decompileOperationGroup/operations.d.ts +9 -0
- package/dist/esm/api/decompileOperationGroup/operations.js +37 -0
- package/dist/esm/api/decompileOperationGroup/operations.js.map +1 -0
- package/dist/esm/api/decompileOperationGroup/options.d.ts +5 -0
- package/dist/esm/api/decompileOperationGroup/options.js +4 -0
- package/dist/esm/api/decompileOperationGroup/options.js.map +1 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/api/index.js +4 -0
- package/dist/esm/api/index.js.map +1 -0
- package/dist/esm/bicepClient.d.ts +15 -0
- package/dist/esm/bicepClient.js +25 -0
- package/dist/esm/bicepClient.js.map +1 -0
- package/dist/esm/classic/decompileOperationGroup/index.d.ts +10 -0
- package/dist/esm/classic/decompileOperationGroup/index.js +14 -0
- package/dist/esm/classic/decompileOperationGroup/index.js.map +1 -0
- package/dist/esm/classic/index.d.ts +2 -0
- package/dist/esm/classic/index.js +4 -0
- package/dist/esm/classic/index.js.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.d.ts +2 -0
- package/dist/esm/logger.js +5 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/models/models.d.ts +59 -0
- package/dist/esm/models/models.js +61 -0
- package/dist/esm/models/models.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/esm/static-helpers/urlTemplate.js +169 -0
- package/dist/esm/static-helpers/urlTemplate.js.map +1 -0
- package/dist/react-native/api/bicepContext.d.ts +19 -0
- package/dist/react-native/api/bicepContext.js +38 -0
- package/dist/react-native/api/bicepContext.js.map +1 -0
- package/dist/react-native/api/decompileOperationGroup/index.d.ts +3 -0
- package/dist/react-native/api/decompileOperationGroup/index.js +4 -0
- package/dist/react-native/api/decompileOperationGroup/index.js.map +1 -0
- package/dist/react-native/api/decompileOperationGroup/operations.d.ts +9 -0
- package/dist/react-native/api/decompileOperationGroup/operations.js +37 -0
- package/dist/react-native/api/decompileOperationGroup/operations.js.map +1 -0
- package/dist/react-native/api/decompileOperationGroup/options.d.ts +5 -0
- package/dist/react-native/api/decompileOperationGroup/options.js +4 -0
- package/dist/react-native/api/decompileOperationGroup/options.js.map +1 -0
- package/dist/react-native/api/index.d.ts +2 -0
- package/dist/react-native/api/index.js +4 -0
- package/dist/react-native/api/index.js.map +1 -0
- package/dist/react-native/bicepClient.d.ts +15 -0
- package/dist/react-native/bicepClient.js +25 -0
- package/dist/react-native/bicepClient.js.map +1 -0
- package/dist/react-native/classic/decompileOperationGroup/index.d.ts +10 -0
- package/dist/react-native/classic/decompileOperationGroup/index.js +14 -0
- package/dist/react-native/classic/decompileOperationGroup/index.js.map +1 -0
- package/dist/react-native/classic/index.d.ts +2 -0
- package/dist/react-native/classic/index.js +4 -0
- package/dist/react-native/classic/index.js.map +1 -0
- package/dist/react-native/index.d.ts +6 -0
- package/dist/react-native/index.js +5 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/logger.d.ts +2 -0
- package/dist/react-native/logger.js +5 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/models/index.d.ts +2 -0
- package/dist/react-native/models/index.js +4 -0
- package/dist/react-native/models/index.js.map +1 -0
- package/dist/react-native/models/models.d.ts +59 -0
- package/dist/react-native/models/models.js +61 -0
- package/dist/react-native/models/models.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/react-native/static-helpers/urlTemplate.js +169 -0
- package/dist/react-native/static-helpers/urlTemplate.js.map +1 -0
- package/package.json +192 -0
- package/review/arm-resourcesbicep-api-decompileOperationGroup-node.api.md +19 -0
- package/review/arm-resourcesbicep-api-node.api.md +27 -0
- package/review/arm-resourcesbicep-models-node.api.md +51 -0
- package/review/arm-resourcesbicep-node.api.md +77 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"arm-resourcesbicep\");\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAOL,aAAa,GACd,MAAM,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n DecompileOperationRequest,\n DecompileOperationSuccessResponse,\n FileDefinition,\n ErrorResponse,\n ErrorDetail,\n ErrorAdditionalInfo,\n KnownVersions,\n} from \"./models.js\";\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** The body of the request for the decompileBicep operation */
|
|
2
|
+
export interface DecompileOperationRequest {
|
|
3
|
+
/** The ARM json template to be decompiled into a Bicep file */
|
|
4
|
+
template: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function decompileOperationRequestSerializer(item: DecompileOperationRequest): any;
|
|
7
|
+
/** The response of the decompileBicep operation */
|
|
8
|
+
export interface DecompileOperationSuccessResponse {
|
|
9
|
+
/** An array of key-value pairs containing the entryPoint string as the key for the Bicep file decompiled from the ARM json template */
|
|
10
|
+
files: FileDefinition[];
|
|
11
|
+
/** The file path to the main Bicep file generated from the decompiled ARM json template. */
|
|
12
|
+
entryPoint: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function decompileOperationSuccessResponseDeserializer(item: any): DecompileOperationSuccessResponse;
|
|
15
|
+
export declare function fileDefinitionArrayDeserializer(result: Array<FileDefinition>): any[];
|
|
16
|
+
/** The definition of a file along with its contents */
|
|
17
|
+
export interface FileDefinition {
|
|
18
|
+
/** The file path of the Bicep file. */
|
|
19
|
+
path?: string;
|
|
20
|
+
/** The contents of the Bicep file. */
|
|
21
|
+
contents?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function fileDefinitionDeserializer(item: any): FileDefinition;
|
|
24
|
+
/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */
|
|
25
|
+
export interface ErrorResponse {
|
|
26
|
+
/** The error object. */
|
|
27
|
+
error?: ErrorDetail;
|
|
28
|
+
}
|
|
29
|
+
export declare function errorResponseDeserializer(item: any): ErrorResponse;
|
|
30
|
+
/** The error detail. */
|
|
31
|
+
export interface ErrorDetail {
|
|
32
|
+
/** The error code. */
|
|
33
|
+
readonly code?: string;
|
|
34
|
+
/** The error message. */
|
|
35
|
+
readonly message?: string;
|
|
36
|
+
/** The error target. */
|
|
37
|
+
readonly target?: string;
|
|
38
|
+
/** The error details. */
|
|
39
|
+
readonly details?: ErrorDetail[];
|
|
40
|
+
/** The error additional info. */
|
|
41
|
+
readonly additionalInfo?: ErrorAdditionalInfo[];
|
|
42
|
+
}
|
|
43
|
+
export declare function errorDetailDeserializer(item: any): ErrorDetail;
|
|
44
|
+
export declare function errorDetailArrayDeserializer(result: Array<ErrorDetail>): any[];
|
|
45
|
+
export declare function errorAdditionalInfoArrayDeserializer(result: Array<ErrorAdditionalInfo>): any[];
|
|
46
|
+
/** The resource management error additional info. */
|
|
47
|
+
export interface ErrorAdditionalInfo {
|
|
48
|
+
/** The additional info type. */
|
|
49
|
+
readonly type?: string;
|
|
50
|
+
/** The additional info. */
|
|
51
|
+
readonly info?: any;
|
|
52
|
+
}
|
|
53
|
+
export declare function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo;
|
|
54
|
+
/** The available API versions. */
|
|
55
|
+
export declare enum KnownVersions {
|
|
56
|
+
/** The 2023-11-01 API version. */
|
|
57
|
+
V20231101 = "2023-11-01"
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
export function decompileOperationRequestSerializer(item) {
|
|
4
|
+
return { template: item["template"] };
|
|
5
|
+
}
|
|
6
|
+
export function decompileOperationSuccessResponseDeserializer(item) {
|
|
7
|
+
return {
|
|
8
|
+
files: fileDefinitionArrayDeserializer(item["files"]),
|
|
9
|
+
entryPoint: item["entryPoint"],
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function fileDefinitionArrayDeserializer(result) {
|
|
13
|
+
return result.map((item) => {
|
|
14
|
+
return fileDefinitionDeserializer(item);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function fileDefinitionDeserializer(item) {
|
|
18
|
+
return {
|
|
19
|
+
path: item["path"],
|
|
20
|
+
contents: item["contents"],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function errorResponseDeserializer(item) {
|
|
24
|
+
return {
|
|
25
|
+
error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function errorDetailDeserializer(item) {
|
|
29
|
+
return {
|
|
30
|
+
code: item["code"],
|
|
31
|
+
message: item["message"],
|
|
32
|
+
target: item["target"],
|
|
33
|
+
details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]),
|
|
34
|
+
additionalInfo: !item["additionalInfo"]
|
|
35
|
+
? item["additionalInfo"]
|
|
36
|
+
: errorAdditionalInfoArrayDeserializer(item["additionalInfo"]),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function errorDetailArrayDeserializer(result) {
|
|
40
|
+
return result.map((item) => {
|
|
41
|
+
return errorDetailDeserializer(item);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export function errorAdditionalInfoArrayDeserializer(result) {
|
|
45
|
+
return result.map((item) => {
|
|
46
|
+
return errorAdditionalInfoDeserializer(item);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export function errorAdditionalInfoDeserializer(item) {
|
|
50
|
+
return {
|
|
51
|
+
type: item["type"],
|
|
52
|
+
info: item["info"],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** The available API versions. */
|
|
56
|
+
export var KnownVersions;
|
|
57
|
+
(function (KnownVersions) {
|
|
58
|
+
/** The 2023-11-01 API version. */
|
|
59
|
+
KnownVersions["V20231101"] = "2023-11-01";
|
|
60
|
+
})(KnownVersions || (KnownVersions = {}));
|
|
61
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/models/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,MAAM,UAAU,mCAAmC,CAAC,IAA+B;IACjF,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CA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AC,IAAI,CAAC,gBAAgB,CAAC,CAAC;KACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAA0B;IACrE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,oCAAoC,CAAC,MAAkC;IACrF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,+BAA+B,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC;AAUD,MAAM,UAAU,+BAA+B,CAAC,IAAS;IACvD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;KACnB,CAAC;AACJ,CAAC;AAED,kCAAkC;AAClC,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAkC;IAClC,yCAAwB,CAAA;AAC1B,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** The body of the request for the decompileBicep operation */\nexport interface DecompileOperationRequest {\n /** The ARM json template to be decompiled into a Bicep file */\n template: string;\n}\n\nexport function decompileOperationRequestSerializer(item: DecompileOperationRequest): any {\n return { template: item[\"template\"] };\n}\n\n/** The response of the decompileBicep operation */\nexport interface DecompileOperationSuccessResponse {\n /** An array of key-value pairs containing the entryPoint string as the key for the Bicep file decompiled from the ARM json template */\n files: FileDefinition[];\n /** The file path to the main Bicep file generated from the decompiled ARM json template. */\n entryPoint: string;\n}\n\nexport function decompileOperationSuccessResponseDeserializer(\n item: any,\n): DecompileOperationSuccessResponse {\n return {\n files: fileDefinitionArrayDeserializer(item[\"files\"]),\n entryPoint: item[\"entryPoint\"],\n };\n}\n\nexport function fileDefinitionArrayDeserializer(result: Array<FileDefinition>): any[] {\n return result.map((item) => {\n return fileDefinitionDeserializer(item);\n });\n}\n\n/** The definition of a file along with its contents */\nexport interface FileDefinition {\n /** The file path of the Bicep file. */\n path?: string;\n /** The contents of the Bicep file. */\n contents?: string;\n}\n\nexport function fileDefinitionDeserializer(item: any): FileDefinition {\n return {\n path: item[\"path\"],\n contents: item[\"contents\"],\n };\n}\n\n/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */\nexport interface ErrorResponse {\n /** The error object. */\n error?: ErrorDetail;\n}\n\nexport function errorResponseDeserializer(item: any): ErrorResponse {\n return {\n error: !item[\"error\"] ? item[\"error\"] : errorDetailDeserializer(item[\"error\"]),\n };\n}\n\n/** The error detail. */\nexport interface ErrorDetail {\n /** The error code. */\n readonly code?: string;\n /** The error message. */\n readonly message?: string;\n /** The error target. */\n readonly target?: string;\n /** The error details. */\n readonly details?: ErrorDetail[];\n /** The error additional info. */\n readonly additionalInfo?: ErrorAdditionalInfo[];\n}\n\nexport function errorDetailDeserializer(item: any): ErrorDetail {\n return {\n code: item[\"code\"],\n message: item[\"message\"],\n target: item[\"target\"],\n details: !item[\"details\"] ? item[\"details\"] : errorDetailArrayDeserializer(item[\"details\"]),\n additionalInfo: !item[\"additionalInfo\"]\n ? item[\"additionalInfo\"]\n : errorAdditionalInfoArrayDeserializer(item[\"additionalInfo\"]),\n };\n}\n\nexport function errorDetailArrayDeserializer(result: Array<ErrorDetail>): any[] {\n return result.map((item) => {\n return errorDetailDeserializer(item);\n });\n}\n\nexport function errorAdditionalInfoArrayDeserializer(result: Array<ErrorAdditionalInfo>): any[] {\n return result.map((item) => {\n return errorAdditionalInfoDeserializer(item);\n });\n}\n\n/** The resource management error additional info. */\nexport interface ErrorAdditionalInfo {\n /** The additional info type. */\n readonly type?: string;\n /** The additional info. */\n readonly info?: any;\n}\n\nexport function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo {\n return {\n type: item[\"type\"],\n info: item[\"info\"],\n };\n}\n\n/** The available API versions. */\nexport enum KnownVersions {\n /** The 2023-11-01 API version. */\n V20231101 = \"2023-11-01\",\n}\n"]}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
// ---------------------
|
|
4
|
+
// helpers
|
|
5
|
+
// ---------------------
|
|
6
|
+
function encodeComponent(val, reserved, op) {
|
|
7
|
+
return (reserved ?? op === "+") || op === "#"
|
|
8
|
+
? encodeReservedComponent(val)
|
|
9
|
+
: encodeRFC3986URIComponent(val);
|
|
10
|
+
}
|
|
11
|
+
function encodeReservedComponent(str) {
|
|
12
|
+
return str
|
|
13
|
+
.split(/(%[0-9A-Fa-f]{2})/g)
|
|
14
|
+
.map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part))
|
|
15
|
+
.join("");
|
|
16
|
+
}
|
|
17
|
+
function encodeRFC3986URIComponent(str) {
|
|
18
|
+
return encodeURIComponent(str).replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
19
|
+
}
|
|
20
|
+
function isDefined(val) {
|
|
21
|
+
return val !== undefined && val !== null;
|
|
22
|
+
}
|
|
23
|
+
function getNamedAndIfEmpty(op) {
|
|
24
|
+
return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""];
|
|
25
|
+
}
|
|
26
|
+
function getFirstOrSep(op, isFirst = false) {
|
|
27
|
+
if (isFirst) {
|
|
28
|
+
return !op || op === "+" ? "" : op;
|
|
29
|
+
}
|
|
30
|
+
else if (!op || op === "+" || op === "#") {
|
|
31
|
+
return ",";
|
|
32
|
+
}
|
|
33
|
+
else if (op === "?") {
|
|
34
|
+
return "&";
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return op;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function getExpandedValue(option) {
|
|
41
|
+
let isFirst = option.isFirst;
|
|
42
|
+
const { op, varName, varValue: value, reserved } = option;
|
|
43
|
+
const vals = [];
|
|
44
|
+
const [named, ifEmpty] = getNamedAndIfEmpty(op);
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
for (const val of value.filter(isDefined)) {
|
|
47
|
+
// prepare the following parts: separator, varName, value
|
|
48
|
+
vals.push(`${getFirstOrSep(op, isFirst)}`);
|
|
49
|
+
if (named && varName) {
|
|
50
|
+
vals.push(`${encodeURIComponent(varName)}`);
|
|
51
|
+
val === "" ? vals.push(ifEmpty) : vals.push("=");
|
|
52
|
+
}
|
|
53
|
+
vals.push(encodeComponent(val, reserved, op));
|
|
54
|
+
isFirst = false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (typeof value === "object") {
|
|
58
|
+
for (const key of Object.keys(value)) {
|
|
59
|
+
const val = value[key];
|
|
60
|
+
if (!isDefined(val)) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
// prepare the following parts: separator, key, value
|
|
64
|
+
vals.push(`${getFirstOrSep(op, isFirst)}`);
|
|
65
|
+
if (key) {
|
|
66
|
+
vals.push(`${encodeURIComponent(key)}`);
|
|
67
|
+
named && val === "" ? vals.push(ifEmpty) : vals.push("=");
|
|
68
|
+
}
|
|
69
|
+
vals.push(encodeComponent(val, reserved, op));
|
|
70
|
+
isFirst = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return vals.join("");
|
|
74
|
+
}
|
|
75
|
+
function getNonExpandedValue(option) {
|
|
76
|
+
const { op, varName, varValue: value, isFirst, reserved } = option;
|
|
77
|
+
const vals = [];
|
|
78
|
+
const first = getFirstOrSep(op, isFirst);
|
|
79
|
+
const [named, ifEmpty] = getNamedAndIfEmpty(op);
|
|
80
|
+
if (named && varName) {
|
|
81
|
+
vals.push(encodeComponent(varName, reserved, op));
|
|
82
|
+
if (value === "") {
|
|
83
|
+
if (!ifEmpty) {
|
|
84
|
+
vals.push(ifEmpty);
|
|
85
|
+
}
|
|
86
|
+
return !vals.join("") ? undefined : `${first}${vals.join("")}`;
|
|
87
|
+
}
|
|
88
|
+
vals.push("=");
|
|
89
|
+
}
|
|
90
|
+
const items = [];
|
|
91
|
+
if (Array.isArray(value)) {
|
|
92
|
+
for (const val of value.filter(isDefined)) {
|
|
93
|
+
items.push(encodeComponent(val, reserved, op));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else if (typeof value === "object") {
|
|
97
|
+
for (const key of Object.keys(value)) {
|
|
98
|
+
if (!isDefined(value[key])) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
items.push(encodeRFC3986URIComponent(key));
|
|
102
|
+
items.push(encodeComponent(value[key], reserved, op));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
vals.push(items.join(","));
|
|
106
|
+
return !vals.join(",") ? undefined : `${first}${vals.join("")}`;
|
|
107
|
+
}
|
|
108
|
+
function getVarValue(option) {
|
|
109
|
+
const { op, varName, modifier, isFirst, reserved, varValue: value } = option;
|
|
110
|
+
if (!isDefined(value)) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
else if (["string", "number", "boolean"].includes(typeof value)) {
|
|
114
|
+
let val = value.toString();
|
|
115
|
+
const [named, ifEmpty] = getNamedAndIfEmpty(op);
|
|
116
|
+
const vals = [getFirstOrSep(op, isFirst)];
|
|
117
|
+
if (named && varName) {
|
|
118
|
+
// No need to encode varName considering it is already encoded
|
|
119
|
+
vals.push(varName);
|
|
120
|
+
val === "" ? vals.push(ifEmpty) : vals.push("=");
|
|
121
|
+
}
|
|
122
|
+
if (modifier && modifier !== "*") {
|
|
123
|
+
val = val.substring(0, parseInt(modifier, 10));
|
|
124
|
+
}
|
|
125
|
+
vals.push(encodeComponent(val, reserved, op));
|
|
126
|
+
return vals.join("");
|
|
127
|
+
}
|
|
128
|
+
else if (modifier === "*") {
|
|
129
|
+
return getExpandedValue(option);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return getNonExpandedValue(option);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// ---------------------------------------------------------------------------------------------------
|
|
136
|
+
// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570.
|
|
137
|
+
// ---------------------------------------------------------------------------------------------------
|
|
138
|
+
export function expandUrlTemplate(template, context, option) {
|
|
139
|
+
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, (_, expr, text) => {
|
|
140
|
+
if (!expr) {
|
|
141
|
+
return encodeReservedComponent(text);
|
|
142
|
+
}
|
|
143
|
+
let op;
|
|
144
|
+
if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) {
|
|
145
|
+
((op = expr[0]), (expr = expr.slice(1)));
|
|
146
|
+
}
|
|
147
|
+
const varList = expr.split(/,/g);
|
|
148
|
+
const result = [];
|
|
149
|
+
for (const varSpec of varList) {
|
|
150
|
+
const varMatch = /([^:\*]*)(?::(\d+)|(\*))?/.exec(varSpec);
|
|
151
|
+
if (!varMatch || !varMatch[1]) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const varValue = getVarValue({
|
|
155
|
+
isFirst: result.length === 0,
|
|
156
|
+
op,
|
|
157
|
+
varValue: context[varMatch[1]],
|
|
158
|
+
varName: varMatch[1],
|
|
159
|
+
modifier: varMatch[2] || varMatch[3],
|
|
160
|
+
reserved: option?.allowReserved,
|
|
161
|
+
});
|
|
162
|
+
if (varValue) {
|
|
163
|
+
result.push(varValue);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return result.join("");
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=urlTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlTemplate.js","sourceRoot":"","sources":["../../../src/static-helpers/urlTemplate.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAmBlC,wBAAwB;AACxB,UAAU;AACV,wB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AI,OAAO,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3D,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9B,SAAS;YACX,CAAC;YACD,MAAM,QAAQ,GAAG,WAAW,CAAC;gBAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;gBAC5B,EAAE;gBACF,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC9B,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC;gBACpC,QAAQ,EAAE,MAAM,EAAE,aAAa;aAChC,CAAC,CAAC;YACH,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n//---------------------\n// interfaces\n//---------------------\ninterface ValueOptions {\n isFirst: boolean; // is first value in the expression\n op?: string; // operator\n varValue?: any; // variable value\n varName?: string; // variable name\n modifier?: string; // modifier e.g *\n reserved?: boolean; // if true we'll keep reserved words with not encoding\n}\n\nexport interface UrlTemplateOptions {\n // if set to true, reserved characters will not be encoded\n allowReserved?: boolean;\n}\n\n// ---------------------\n// helpers\n// ---------------------\nfunction encodeComponent(val: string, reserved?: boolean, op?: string) {\n return (reserved ?? op === \"+\") || op === \"#\"\n ? encodeReservedComponent(val)\n : encodeRFC3986URIComponent(val);\n}\n\nfunction encodeReservedComponent(str: string) {\n return str\n .split(/(%[0-9A-Fa-f]{2})/g)\n .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part))\n .join(\"\");\n}\n\nfunction encodeRFC3986URIComponent(str: string) {\n return encodeURIComponent(str).replace(\n /[!'()*]/g,\n (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,\n );\n}\n\nfunction isDefined(val: any) {\n return val !== undefined && val !== null;\n}\n\nfunction getNamedAndIfEmpty(op?: string): [boolean, string] {\n return [!!op && [\";\", \"?\", \"&\"].includes(op), !!op && [\"?\", \"&\"].includes(op) ? \"=\" : \"\"];\n}\n\nfunction getFirstOrSep(op?: string, isFirst = false) {\n if (isFirst) {\n return !op || op === \"+\" ? \"\" : op;\n } else if (!op || op === \"+\" || op === \"#\") {\n return \",\";\n } else if (op === \"?\") {\n return \"&\";\n } else {\n return op;\n }\n}\n\nfunction getExpandedValue(option: ValueOptions) {\n let isFirst = option.isFirst;\n const { op, varName, varValue: value, reserved } = option;\n const vals: string[] = [];\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n\n if (Array.isArray(value)) {\n for (const val of value.filter(isDefined)) {\n // prepare the following parts: separator, varName, value\n vals.push(`${getFirstOrSep(op, isFirst)}`);\n if (named && varName) {\n vals.push(`${encodeURIComponent(varName)}`);\n val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n vals.push(encodeComponent(val, reserved, op));\n isFirst = false;\n }\n } else if (typeof value === \"object\") {\n for (const key of Object.keys(value)) {\n const val = value[key];\n if (!isDefined(val)) {\n continue;\n }\n // prepare the following parts: separator, key, value\n vals.push(`${getFirstOrSep(op, isFirst)}`);\n if (key) {\n vals.push(`${encodeURIComponent(key)}`);\n named && val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n vals.push(encodeComponent(val, reserved, op));\n isFirst = false;\n }\n }\n return vals.join(\"\");\n}\n\nfunction getNonExpandedValue(option: ValueOptions) {\n const { op, varName, varValue: value, isFirst, reserved } = option;\n const vals: string[] = [];\n const first = getFirstOrSep(op, isFirst);\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n if (named && varName) {\n vals.push(encodeComponent(varName, reserved, op));\n if (value === \"\") {\n if (!ifEmpty) {\n vals.push(ifEmpty);\n }\n return !vals.join(\"\") ? undefined : `${first}${vals.join(\"\")}`;\n }\n vals.push(\"=\");\n }\n\n const items = [];\n if (Array.isArray(value)) {\n for (const val of value.filter(isDefined)) {\n items.push(encodeComponent(val, reserved, op));\n }\n } else if (typeof value === \"object\") {\n for (const key of Object.keys(value)) {\n if (!isDefined(value[key])) {\n continue;\n }\n items.push(encodeRFC3986URIComponent(key));\n items.push(encodeComponent(value[key], reserved, op));\n }\n }\n vals.push(items.join(\",\"));\n return !vals.join(\",\") ? undefined : `${first}${vals.join(\"\")}`;\n}\n\nfunction getVarValue(option: ValueOptions): string | undefined {\n const { op, varName, modifier, isFirst, reserved, varValue: value } = option;\n\n if (!isDefined(value)) {\n return undefined;\n } else if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n let val = value.toString();\n const [named, ifEmpty] = getNamedAndIfEmpty(op);\n const vals: string[] = [getFirstOrSep(op, isFirst)];\n if (named && varName) {\n // No need to encode varName considering it is already encoded\n vals.push(varName);\n val === \"\" ? vals.push(ifEmpty) : vals.push(\"=\");\n }\n if (modifier && modifier !== \"*\") {\n val = val.substring(0, parseInt(modifier, 10));\n }\n vals.push(encodeComponent(val, reserved, op));\n return vals.join(\"\");\n } else if (modifier === \"*\") {\n return getExpandedValue(option);\n } else {\n return getNonExpandedValue(option);\n }\n}\n\n// ---------------------------------------------------------------------------------------------------\n// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570.\n// ---------------------------------------------------------------------------------------------------\nexport function expandUrlTemplate(\n template: string,\n context: Record<string, any>,\n option?: UrlTemplateOptions,\n): string {\n return template.replace(/\\{([^\\{\\}]+)\\}|([^\\{\\}]+)/g, (_, expr, text) => {\n if (!expr) {\n return encodeReservedComponent(text);\n }\n let op;\n if ([\"+\", \"#\", \".\", \"/\", \";\", \"?\", \"&\"].includes(expr[0])) {\n ((op = expr[0]), (expr = expr.slice(1)));\n }\n const varList = expr.split(/,/g);\n const result = [];\n for (const varSpec of varList) {\n const varMatch = /([^:\\*]*)(?::(\\d+)|(\\*))?/.exec(varSpec);\n if (!varMatch || !varMatch[1]) {\n continue;\n }\n const varValue = getVarValue({\n isFirst: result.length === 0,\n op,\n varValue: context[varMatch[1]],\n varName: varMatch[1],\n modifier: varMatch[2] || varMatch[3],\n reserved: option?.allowReserved,\n });\n if (varValue) {\n result.push(varValue);\n }\n }\n return result.join(\"\");\n });\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Client, ClientOptions } from "@azure-rest/core-client";
|
|
2
|
+
import { TokenCredential } from "@azure/core-auth";
|
|
3
|
+
/** Bicep Client */
|
|
4
|
+
export interface BicepContext extends Client {
|
|
5
|
+
/** The API version to use for this operation. */
|
|
6
|
+
/** Known values of {@link KnownVersions} that the service accepts. */
|
|
7
|
+
apiVersion: string;
|
|
8
|
+
/** The ID of the target subscription. The value must be an UUID. */
|
|
9
|
+
subscriptionId: string;
|
|
10
|
+
}
|
|
11
|
+
/** Optional parameters for the client. */
|
|
12
|
+
export interface BicepClientOptionalParams extends ClientOptions {
|
|
13
|
+
/** The API version to use for this operation. */
|
|
14
|
+
/** Known values of {@link KnownVersions} that the service accepts. */
|
|
15
|
+
apiVersion?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Bicep Client */
|
|
18
|
+
export declare function createBicep(credential: TokenCredential, subscriptionId: string, options?: BicepClientOptionalParams): BicepContext;
|
|
19
|
+
//# sourceMappingURL=bicepContext.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { logger } from "../logger.js";
|
|
4
|
+
import { getClient } from "@azure-rest/core-client";
|
|
5
|
+
/** Bicep Client */
|
|
6
|
+
export function createBicep(credential, subscriptionId, options = {}) {
|
|
7
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? "https://management.azure.com";
|
|
8
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
9
|
+
const userAgentInfo = `azsdk-js-arm-resourcesbicep/1.0.0-beta.1`;
|
|
10
|
+
const userAgentPrefix = prefixFromOptions
|
|
11
|
+
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
|
|
12
|
+
: `azsdk-js-api ${userAgentInfo}`;
|
|
13
|
+
const { apiVersion: _, ...updatedOptions } = {
|
|
14
|
+
...options,
|
|
15
|
+
userAgentOptions: { userAgentPrefix },
|
|
16
|
+
loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
|
|
17
|
+
credentials: {
|
|
18
|
+
scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const clientContext = getClient(endpointUrl, credential, updatedOptions);
|
|
22
|
+
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
23
|
+
const apiVersion = options.apiVersion ?? "2023-11-01";
|
|
24
|
+
clientContext.pipeline.addPolicy({
|
|
25
|
+
name: "ClientApiVersionPolicy",
|
|
26
|
+
sendRequest: (req, next) => {
|
|
27
|
+
// Use the apiVersion defined in request url directly
|
|
28
|
+
// Append one if there is no apiVersion and we have one at client options
|
|
29
|
+
const url = new URL(req.url);
|
|
30
|
+
if (!url.searchParams.get("api-version")) {
|
|
31
|
+
req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
|
|
32
|
+
}
|
|
33
|
+
return next(req);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return { ...clientContext, apiVersion, subscriptionId };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=bicepContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bicepContext.js","sourceRoot":"","sources":["../../../src/api/bicepContext.ts"],"names":[],"mappings":"A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B,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,aAAa,EAAE,UAAU,EAAE,cAAc,EAAkB,CAAC;AAC1E,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\n/** Bicep Client */\nexport interface BicepContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n /** The ID of the target subscription. The value must be an UUID. */\n subscriptionId: string;\n}\n\n/** Optional parameters for the client. */\nexport interface BicepClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\n/** Bicep Client */\nexport function createBicep(\n credential: TokenCredential,\n subscriptionId: string,\n options: BicepClientOptionalParams = {},\n): BicepContext {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? \"https://management.azure.com\";\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-arm-resourcesbicep/1.0.0-beta.1`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"2023-11-01\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return { ...clientContext, apiVersion, subscriptionId } as BicepContext;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/decompileOperationGroup/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { bicep } from \"./operations.js\";\nexport { DecompileOperationGroupBicepOptionalParams } from \"./options.js\";\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BicepContext as Client } from "../index.js";
|
|
2
|
+
import { DecompileOperationRequest, DecompileOperationSuccessResponse } from "../../models/models.js";
|
|
3
|
+
import { DecompileOperationGroupBicepOptionalParams } from "./options.js";
|
|
4
|
+
import { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
5
|
+
export declare function _bicepSend(context: Client, decompileOperationRequest: DecompileOperationRequest, options?: DecompileOperationGroupBicepOptionalParams): StreamableMethod;
|
|
6
|
+
export declare function _bicepDeserialize(result: PathUncheckedResponse): Promise<DecompileOperationSuccessResponse>;
|
|
7
|
+
/** Decompiles an ARM json template into a Bicep template */
|
|
8
|
+
export declare function bicep(context: Client, decompileOperationRequest: DecompileOperationRequest, options?: DecompileOperationGroupBicepOptionalParams): Promise<DecompileOperationSuccessResponse>;
|
|
9
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { decompileOperationRequestSerializer, decompileOperationSuccessResponseDeserializer, errorResponseDeserializer, } from "../../models/models.js";
|
|
4
|
+
import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js";
|
|
5
|
+
import { createRestError, operationOptionsToRequestParameters, } from "@azure-rest/core-client";
|
|
6
|
+
export function _bicepSend(context, decompileOperationRequest, options = { requestOptions: {} }) {
|
|
7
|
+
const path = expandUrlTemplate("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/decompileBicep{?api%2Dversion}", {
|
|
8
|
+
subscriptionId: context.subscriptionId,
|
|
9
|
+
"api%2Dversion": context.apiVersion,
|
|
10
|
+
}, {
|
|
11
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
12
|
+
});
|
|
13
|
+
return context.path(path).post({
|
|
14
|
+
...operationOptionsToRequestParameters(options),
|
|
15
|
+
contentType: "application/json",
|
|
16
|
+
headers: {
|
|
17
|
+
accept: "application/json",
|
|
18
|
+
...options.requestOptions?.headers,
|
|
19
|
+
},
|
|
20
|
+
body: decompileOperationRequestSerializer(decompileOperationRequest),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export async function _bicepDeserialize(result) {
|
|
24
|
+
const expectedStatuses = ["200"];
|
|
25
|
+
if (!expectedStatuses.includes(result.status)) {
|
|
26
|
+
const error = createRestError(result);
|
|
27
|
+
error.details = errorResponseDeserializer(result.body);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
return decompileOperationSuccessResponseDeserializer(result.body);
|
|
31
|
+
}
|
|
32
|
+
/** Decompiles an ARM json template into a Bicep template */
|
|
33
|
+
export async function bicep(context, decompileOperationRequest, options = { requestOptions: {} }) {
|
|
34
|
+
const result = await _bicepSend(context, decompileOperationRequest, options);
|
|
35
|
+
return _bicepDeserialize(result);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/decompileOperationGroup/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,mCAAmC,EAEnC,6CAA6C,EAC7C,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAGL,eAAe,EACf,mCAAmC,GACpC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,UAAU,CACxB,OAAe,EACf,yBAAoD,EACpD,UAAsD,EAAE,cAAc,EAAE,EAAE,EAAE;IAE5E,MAAM,IAAI,GAAG,iBAAiB,CAC5B,8FAA8F,EAC9F;QACE,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,eAAe,EAAE,OAAO,CAAC,UAAU;KACpC,EACD;QACE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe;KACxD,CACF,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAC7B,GAAG,mCAAmC,CAAC,OAAO,CAAC;QAC/C,WAAW,EAAE,kBAAkB;QAC/B,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,GAAG,OAAO,CAAC,cAAc,EAAE,OAAO;SACnC;QACD,IAAI,EAAE,mCAAmC,CAAC,yBAAyB,CAAC;KACrE,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA6B;IAE7B,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACtC,KAAK,CAAC,OAAO,GAAG,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,6CAA6C,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,OAAe,EACf,yBAAoD,EACpD,UAAsD,EAAE,cAAc,EAAE,EAAE,EAAE;IAE5E,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,yBAAyB,EAAE,OAAO,CAAC,CAAC;IAC7E,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { BicepContext as Client } from \"../index.js\";\nimport {\n DecompileOperationRequest,\n decompileOperationRequestSerializer,\n DecompileOperationSuccessResponse,\n decompileOperationSuccessResponseDeserializer,\n errorResponseDeserializer,\n} from \"../../models/models.js\";\nimport { DecompileOperationGroupBicepOptionalParams } from \"./options.js\";\nimport { expandUrlTemplate } from \"../../static-helpers/urlTemplate.js\";\nimport {\n StreamableMethod,\n PathUncheckedResponse,\n createRestError,\n operationOptionsToRequestParameters,\n} from \"@azure-rest/core-client\";\n\nexport function _bicepSend(\n context: Client,\n decompileOperationRequest: DecompileOperationRequest,\n options: DecompileOperationGroupBicepOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/subscriptions/{subscriptionId}/providers/Microsoft.Resources/decompileBicep{?api%2Dversion}\",\n {\n subscriptionId: context.subscriptionId,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: decompileOperationRequestSerializer(decompileOperationRequest),\n });\n}\n\nexport async function _bicepDeserialize(\n result: PathUncheckedResponse,\n): Promise<DecompileOperationSuccessResponse> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = errorResponseDeserializer(result.body);\n throw error;\n }\n\n return decompileOperationSuccessResponseDeserializer(result.body);\n}\n\n/** Decompiles an ARM json template into a Bicep template */\nexport async function bicep(\n context: Client,\n decompileOperationRequest: DecompileOperationRequest,\n options: DecompileOperationGroupBicepOptionalParams = { requestOptions: {} },\n): Promise<DecompileOperationSuccessResponse> {\n const result = await _bicepSend(context, decompileOperationRequest, options);\n return _bicepDeserialize(result);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/api/decompileOperationGroup/options.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { OperationOptions } from \"@azure-rest/core-client\";\n\n/** Optional parameters. */\nexport interface DecompileOperationGroupBicepOptionalParams extends OperationOptions {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAA2C,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { createBicep, BicepContext, BicepClientOptionalParams } from \"./bicepContext.js\";\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BicepClientOptionalParams } from "./api/index.js";
|
|
2
|
+
import { DecompileOperationGroupOperations } from "./classic/decompileOperationGroup/index.js";
|
|
3
|
+
import { Pipeline } from "@azure/core-rest-pipeline";
|
|
4
|
+
import { TokenCredential } from "@azure/core-auth";
|
|
5
|
+
export { BicepClientOptionalParams } from "./api/bicepContext.js";
|
|
6
|
+
export declare class BicepClient {
|
|
7
|
+
private _client;
|
|
8
|
+
/** The pipeline used by this client to make requests */
|
|
9
|
+
readonly pipeline: Pipeline;
|
|
10
|
+
/** Bicep Client */
|
|
11
|
+
constructor(credential: TokenCredential, subscriptionId: string, options?: BicepClientOptionalParams);
|
|
12
|
+
/** The operation groups for decompileOperationGroup */
|
|
13
|
+
readonly decompileOperationGroup: DecompileOperationGroupOperations;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=bicepClient.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createBicep } from "./api/index.js";
|
|
4
|
+
import { _getDecompileOperationGroupOperations, } from "./classic/decompileOperationGroup/index.js";
|
|
5
|
+
export class BicepClient {
|
|
6
|
+
_client;
|
|
7
|
+
/** The pipeline used by this client to make requests */
|
|
8
|
+
pipeline;
|
|
9
|
+
/** Bicep Client */
|
|
10
|
+
constructor(credential, subscriptionId, options = {}) {
|
|
11
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
12
|
+
const userAgentPrefix = prefixFromOptions
|
|
13
|
+
? `${prefixFromOptions} azsdk-js-client`
|
|
14
|
+
: `azsdk-js-client`;
|
|
15
|
+
this._client = createBicep(credential, subscriptionId, {
|
|
16
|
+
...options,
|
|
17
|
+
userAgentOptions: { userAgentPrefix },
|
|
18
|
+
});
|
|
19
|
+
this.pipeline = this._client.pipeline;
|
|
20
|
+
this.decompileOperationGroup = _getDecompileOperationGroupOperations(this._client);
|
|
21
|
+
}
|
|
22
|
+
/** The operation groups for decompileOperationGroup */
|
|
23
|
+
decompileOperationGroup;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=bicepClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bicepClient.js","sourceRoot":"","sources":["../../src/bicepClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAA2C,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAEL,qCAAqC,GACtC,MAAM,4CAA4C,CAAC;AAMpD,MAAM,OAAO,WAAW;IACd,OAAO,CAAe;IAC9B,wDAAwD;IACxC,QAAQ,CAAW;IAEnC,mBAAmB;IACnB,YACE,UAA2B,EAC3B,cAAsB,EACtB,UAAqC,EAAE;QAEvC,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;QACrE,MAAM,eAAe,GAAG,iBAAiB;YACvC,CAAC,CAAC,GAAG,iBAAiB,kBAAkB;YACxC,CAAC,CAAC,iBAAiB,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE;YACrD,GAAG,OAAO;YACV,gBAAgB,EAAE,EAAE,eAAe,EAAE;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,uBAAuB,GAAG,qCAAqC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrF,CAAC;IAED,uDAAuD;IACvC,uBAAuB,CAAoC;CAC5E","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createBicep, BicepContext, BicepClientOptionalParams } from \"./api/index.js\";\nimport {\n DecompileOperationGroupOperations,\n _getDecompileOperationGroupOperations,\n} from \"./classic/decompileOperationGroup/index.js\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport { BicepClientOptionalParams } from \"./api/bicepContext.js\";\n\nexport class BicepClient {\n private _client: BicepContext;\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n /** Bicep Client */\n constructor(\n credential: TokenCredential,\n subscriptionId: string,\n options: BicepClientOptionalParams = {},\n ) {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._client = createBicep(credential, subscriptionId, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n this.pipeline = this._client.pipeline;\n this.decompileOperationGroup = _getDecompileOperationGroupOperations(this._client);\n }\n\n /** The operation groups for decompileOperationGroup */\n public readonly decompileOperationGroup: DecompileOperationGroupOperations;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BicepContext } from "../../api/bicepContext.js";
|
|
2
|
+
import { DecompileOperationRequest, DecompileOperationSuccessResponse } from "../../models/models.js";
|
|
3
|
+
import { DecompileOperationGroupBicepOptionalParams } from "../../api/decompileOperationGroup/options.js";
|
|
4
|
+
/** Interface representing a DecompileOperationGroup operations. */
|
|
5
|
+
export interface DecompileOperationGroupOperations {
|
|
6
|
+
/** Decompiles an ARM json template into a Bicep template */
|
|
7
|
+
bicep: (decompileOperationRequest: DecompileOperationRequest, options?: DecompileOperationGroupBicepOptionalParams) => Promise<DecompileOperationSuccessResponse>;
|
|
8
|
+
}
|
|
9
|
+
export declare function _getDecompileOperationGroupOperations(context: BicepContext): DecompileOperationGroupOperations;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { bicep } from "../../api/decompileOperationGroup/operations.js";
|
|
4
|
+
function _getDecompileOperationGroup(context) {
|
|
5
|
+
return {
|
|
6
|
+
bicep: (decompileOperationRequest, options) => bicep(context, decompileOperationRequest, options),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function _getDecompileOperationGroupOperations(context) {
|
|
10
|
+
return {
|
|
11
|
+
..._getDecompileOperationGroup(context),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/decompileOperationGroup/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAE,KAAK,EAAE,MAAM,iDAAiD,CAAC;AAWxE,SAAS,2BAA2B,CAAC,OAAqB;IACxD,OAAO;QACL,KAAK,EAAE,CACL,yBAAoD,EACpD,OAAoD,EACpD,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,yBAAyB,EAAE,OAAO,CAAC;KACxD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,OAAqB;IAErB,OAAO;QACL,GAAG,2BAA2B,CAAC,OAAO,CAAC;KACxC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { BicepContext } from \"../../api/bicepContext.js\";\nimport {\n DecompileOperationRequest,\n DecompileOperationSuccessResponse,\n} from \"../../models/models.js\";\nimport { DecompileOperationGroupBicepOptionalParams } from \"../../api/decompileOperationGroup/options.js\";\nimport { bicep } from \"../../api/decompileOperationGroup/operations.js\";\n\n/** Interface representing a DecompileOperationGroup operations. */\nexport interface DecompileOperationGroupOperations {\n /** Decompiles an ARM json template into a Bicep template */\n bicep: (\n decompileOperationRequest: DecompileOperationRequest,\n options?: DecompileOperationGroupBicepOptionalParams,\n ) => Promise<DecompileOperationSuccessResponse>;\n}\n\nfunction _getDecompileOperationGroup(context: BicepContext) {\n return {\n bicep: (\n decompileOperationRequest: DecompileOperationRequest,\n options?: DecompileOperationGroupBicepOptionalParams,\n ) => bicep(context, decompileOperationRequest, options),\n };\n}\n\nexport function _getDecompileOperationGroupOperations(\n context: BicepContext,\n): DecompileOperationGroupOperations {\n return {\n ..._getDecompileOperationGroup(context),\n };\n}\n"]}
|