@azure-tools/typespec-azure-resource-manager 0.27.0

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.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +346 -0
  3. package/dist/src/common-types.d.ts +8 -0
  4. package/dist/src/common-types.d.ts.map +1 -0
  5. package/dist/src/common-types.js +14 -0
  6. package/dist/src/common-types.js.map +1 -0
  7. package/dist/src/index.d.ts +7 -0
  8. package/dist/src/index.d.ts.map +1 -0
  9. package/dist/src/index.js +7 -0
  10. package/dist/src/index.js.map +1 -0
  11. package/dist/src/internal.d.ts +44 -0
  12. package/dist/src/internal.d.ts.map +1 -0
  13. package/dist/src/internal.js +142 -0
  14. package/dist/src/internal.js.map +1 -0
  15. package/dist/src/lib.d.ts +615 -0
  16. package/dist/src/lib.d.ts.map +1 -0
  17. package/dist/src/lib.js +250 -0
  18. package/dist/src/lib.js.map +1 -0
  19. package/dist/src/linter.d.ts +3 -0
  20. package/dist/src/linter.d.ts.map +1 -0
  21. package/dist/src/linter.js +42 -0
  22. package/dist/src/linter.js.map +1 -0
  23. package/dist/src/namespace.d.ts +16 -0
  24. package/dist/src/namespace.d.ts.map +1 -0
  25. package/dist/src/namespace.js +106 -0
  26. package/dist/src/namespace.js.map +1 -0
  27. package/dist/src/operations.d.ts +36 -0
  28. package/dist/src/operations.d.ts.map +1 -0
  29. package/dist/src/operations.js +186 -0
  30. package/dist/src/operations.js.map +1 -0
  31. package/dist/src/resource.d.ts +81 -0
  32. package/dist/src/resource.d.ts.map +1 -0
  33. package/dist/src/resource.js +358 -0
  34. package/dist/src/resource.js.map +1 -0
  35. package/dist/src/rules/arm-resource-action-no-segment.d.ts +2 -0
  36. package/dist/src/rules/arm-resource-action-no-segment.d.ts.map +1 -0
  37. package/dist/src/rules/arm-resource-action-no-segment.js +31 -0
  38. package/dist/src/rules/arm-resource-action-no-segment.js.map +1 -0
  39. package/dist/src/rules/arm-resource-invalid-chars.d.ts +2 -0
  40. package/dist/src/rules/arm-resource-invalid-chars.d.ts.map +1 -0
  41. package/dist/src/rules/arm-resource-invalid-chars.js +61 -0
  42. package/dist/src/rules/arm-resource-invalid-chars.js.map +1 -0
  43. package/dist/src/rules/arm-resource-invalid-version-format.d.ts +2 -0
  44. package/dist/src/rules/arm-resource-invalid-version-format.d.ts.map +1 -0
  45. package/dist/src/rules/arm-resource-invalid-version-format.js +48 -0
  46. package/dist/src/rules/arm-resource-invalid-version-format.js.map +1 -0
  47. package/dist/src/rules/arm-resource-operations.d.ts +2 -0
  48. package/dist/src/rules/arm-resource-operations.d.ts.map +1 -0
  49. package/dist/src/rules/arm-resource-operations.js +70 -0
  50. package/dist/src/rules/arm-resource-operations.js.map +1 -0
  51. package/dist/src/rules/arm-resource-properties.d.ts +2 -0
  52. package/dist/src/rules/arm-resource-properties.d.ts.map +1 -0
  53. package/dist/src/rules/arm-resource-properties.js +55 -0
  54. package/dist/src/rules/arm-resource-properties.js.map +1 -0
  55. package/dist/src/rules/arm-resource-provisioning-state-rule.d.ts +2 -0
  56. package/dist/src/rules/arm-resource-provisioning-state-rule.d.ts.map +1 -0
  57. package/dist/src/rules/arm-resource-provisioning-state-rule.js +62 -0
  58. package/dist/src/rules/arm-resource-provisioning-state-rule.js.map +1 -0
  59. package/dist/src/rules/beyond-nesting-levels.d.ts +5 -0
  60. package/dist/src/rules/beyond-nesting-levels.d.ts.map +1 -0
  61. package/dist/src/rules/beyond-nesting-levels.js +37 -0
  62. package/dist/src/rules/beyond-nesting-levels.js.map +1 -0
  63. package/dist/src/rules/core-operations.d.ts +2 -0
  64. package/dist/src/rules/core-operations.d.ts.map +1 -0
  65. package/dist/src/rules/core-operations.js +181 -0
  66. package/dist/src/rules/core-operations.js.map +1 -0
  67. package/dist/src/rules/delete-operation.d.ts +5 -0
  68. package/dist/src/rules/delete-operation.d.ts.map +1 -0
  69. package/dist/src/rules/delete-operation.js +28 -0
  70. package/dist/src/rules/delete-operation.js.map +1 -0
  71. package/dist/src/rules/envelope-properties.d.ts +5 -0
  72. package/dist/src/rules/envelope-properties.d.ts.map +1 -0
  73. package/dist/src/rules/envelope-properties.js +62 -0
  74. package/dist/src/rules/envelope-properties.js.map +1 -0
  75. package/dist/src/rules/list-operation.d.ts +5 -0
  76. package/dist/src/rules/list-operation.d.ts.map +1 -0
  77. package/dist/src/rules/list-operation.js +35 -0
  78. package/dist/src/rules/list-operation.js.map +1 -0
  79. package/dist/src/rules/no-response-body.d.ts +5 -0
  80. package/dist/src/rules/no-response-body.d.ts.map +1 -0
  81. package/dist/src/rules/no-response-body.js +27 -0
  82. package/dist/src/rules/no-response-body.js.map +1 -0
  83. package/dist/src/rules/operations-interface-missing.d.ts +5 -0
  84. package/dist/src/rules/operations-interface-missing.d.ts.map +1 -0
  85. package/dist/src/rules/operations-interface-missing.js +37 -0
  86. package/dist/src/rules/operations-interface-missing.js.map +1 -0
  87. package/dist/src/rules/resource-name.d.ts +5 -0
  88. package/dist/src/rules/resource-name.d.ts.map +1 -0
  89. package/dist/src/rules/resource-name.js +47 -0
  90. package/dist/src/rules/resource-name.js.map +1 -0
  91. package/dist/src/rules/retry-after.d.ts +5 -0
  92. package/dist/src/rules/retry-after.d.ts.map +1 -0
  93. package/dist/src/rules/retry-after.js +31 -0
  94. package/dist/src/rules/retry-after.js.map +1 -0
  95. package/dist/src/rules/unsupported-types.d.ts +5 -0
  96. package/dist/src/rules/unsupported-types.d.ts.map +1 -0
  97. package/dist/src/rules/unsupported-types.js +39 -0
  98. package/dist/src/rules/unsupported-types.js.map +1 -0
  99. package/dist/src/rules/utils.d.ts +18 -0
  100. package/dist/src/rules/utils.d.ts.map +1 -0
  101. package/dist/src/rules/utils.js +77 -0
  102. package/dist/src/rules/utils.js.map +1 -0
  103. package/dist/src/testing/index.d.ts +3 -0
  104. package/dist/src/testing/index.d.ts.map +1 -0
  105. package/dist/src/testing/index.js +24 -0
  106. package/dist/src/testing/index.js.map +1 -0
  107. package/lib/arm.foundations.tsp +465 -0
  108. package/lib/arm.tsp +31 -0
  109. package/lib/decorators.tsp +87 -0
  110. package/lib/interfaces.tsp +287 -0
  111. package/lib/models.tsp +203 -0
  112. package/lib/operations.tsp +260 -0
  113. package/lib/parameters.tsp +126 -0
  114. package/lib/responses.tsp +47 -0
  115. package/package.json +85 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsupported-types.js","sourceRoot":"","sources":["../../../src/rules/unsupported-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpG;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;IAC5C,IAAI,EAAE,mBAAmB;IACzB,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,oBAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAChD,CAAC;YACD,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE;gBAChB,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAC1C,CAAC;SACF,CAAC;QAEF,SAAS,oBAAoB,CAAC,IAAU,EAAE,MAAwB;YAChE,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;gBACnD,OAAO;aACR;YACD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC1B,IAAI,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBAC5C,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,kBAAkB;wBACxB,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE;wBAC/B,MAAM;qBACP,CAAC,CAAC;iBACJ;aACF;YACD,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBAC1B,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,iBAAiB,EAAE;oBAChD,oBAAoB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;iBAC3C;aACF;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Interface, Model, ModelProperty, Namespace, Operation, Program } from "@typespec/compiler";
2
+ import { ArmResourceDetails } from "../resource.js";
3
+ /**
4
+ *
5
+ *@param target
6
+ *@returns true if the operation is defined on a templated interface which hasn't had args filled in
7
+ */
8
+ export declare function isTemplatedInterfaceOperation(target: Operation): boolean | 0 | undefined;
9
+ export declare function isTrackedResource(resourceType: Model): boolean;
10
+ export declare function isResource(resourceType: Model): boolean;
11
+ export declare function isResourceOperation(program: Program, op: Operation): boolean;
12
+ export declare function getProperties(model: Model): ModelProperty[];
13
+ export declare function getInterface(res: ArmResourceDetails): Interface | undefined;
14
+ export declare function getSourceModel(property: ModelProperty): Model | undefined;
15
+ export declare function getSourceProperty(property: ModelProperty): ModelProperty;
16
+ export declare function isInternalTypeSpec(program: Program, type: Model | Operation | ModelProperty | Interface | Namespace): boolean;
17
+ export declare function getNamespaceName(program: Program, type: Model | Operation | ModelProperty | Interface | Namespace | undefined): string;
18
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/rules/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,KAAK,EACL,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EAER,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,2BAO9D;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,KAAK,WAGpD;AAED,wBAAgB,UAAU,CAAC,YAAY,EAAE,KAAK,WAG7C;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,WAElE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,mBAOzC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,kBAAkB,yBAUnD;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,KAAK,GAAG,SAAS,CAOzE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAOxE;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAC9D,OAAO,CAOT;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAC1E,MAAM,CAMR"}
@@ -0,0 +1,77 @@
1
+ import { getNamespaceFullName, SyntaxKind, } from "@typespec/compiler";
2
+ import { getResourceOperation } from "@typespec/rest";
3
+ import { getArmResourceKind } from "../resource.js";
4
+ /**
5
+ *
6
+ *@param target
7
+ *@returns true if the operation is defined on a templated interface which hasn't had args filled in
8
+ */
9
+ export function isTemplatedInterfaceOperation(target) {
10
+ var _a, _b;
11
+ return (((_a = target.node) === null || _a === void 0 ? void 0 : _a.kind) === SyntaxKind.OperationStatement &&
12
+ target.interface &&
13
+ target.interface.node.templateParameters.length &&
14
+ !((_b = target.interface.templateArguments) === null || _b === void 0 ? void 0 : _b.length));
15
+ }
16
+ export function isTrackedResource(resourceType) {
17
+ const resultKind = getArmResourceKind(resourceType);
18
+ return resultKind === "Tracked";
19
+ }
20
+ export function isResource(resourceType) {
21
+ const resultKind = getArmResourceKind(resourceType);
22
+ return !!resultKind;
23
+ }
24
+ export function isResourceOperation(program, op) {
25
+ return !!getResourceOperation(program, op);
26
+ }
27
+ export function getProperties(model) {
28
+ let properties = Array.from(model.properties.values());
29
+ while (model.baseModel) {
30
+ properties = properties.concat(Array.from(model.baseModel.properties.values()));
31
+ model = model.baseModel;
32
+ }
33
+ return properties;
34
+ }
35
+ export function getInterface(res) {
36
+ if (res.operations.lifecycle) {
37
+ for (const op of Object.values(res.operations.lifecycle)) {
38
+ const armOperation = op;
39
+ if (armOperation && armOperation.operation.interface) {
40
+ return armOperation.operation.interface;
41
+ }
42
+ }
43
+ }
44
+ return undefined;
45
+ }
46
+ export function getSourceModel(property) {
47
+ let currProperty = property;
48
+ while (currProperty.sourceProperty !== undefined) {
49
+ currProperty = currProperty.sourceProperty;
50
+ }
51
+ return currProperty === null || currProperty === void 0 ? void 0 : currProperty.model;
52
+ }
53
+ export function getSourceProperty(property) {
54
+ let currProperty = property;
55
+ while (currProperty.sourceProperty !== undefined) {
56
+ currProperty = currProperty.sourceProperty;
57
+ }
58
+ return currProperty !== null && currProperty !== void 0 ? currProperty : property;
59
+ }
60
+ export function isInternalTypeSpec(program, type) {
61
+ const namespace = getNamespaceName(program, type);
62
+ return (namespace.startsWith("TypeSpec") ||
63
+ namespace.startsWith("Azure.ResourceManager") ||
64
+ namespace.startsWith("Azure.Core"));
65
+ }
66
+ export function getNamespaceName(program, type) {
67
+ if (type === undefined)
68
+ return "";
69
+ if (type.kind === "ModelProperty")
70
+ return type.model ? getNamespaceName(program, type.model) : "";
71
+ if (type.kind !== "Namespace")
72
+ type = type.namespace;
73
+ if (type === undefined)
74
+ return "";
75
+ return getNamespaceFullName(type);
76
+ }
77
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/rules/utils.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nC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,OAAgB,EAChB,IAA2E;IAE3E,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAClC,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClG,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW;QAAE,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;IACrD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAClC,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TypeSpecTestLibrary } from "@typespec/compiler/testing";
2
+ export declare const AzureResourceManagerTestLibrary: TypeSpecTestLibrary;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,eAAO,MAAM,+BAA+B,EAAE,mBAoB7C,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { resolvePath } from "@typespec/compiler";
2
+ import { fileURLToPath } from "url";
3
+ export const AzureResourceManagerTestLibrary = {
4
+ name: "@azure-tools/typespec-azure-resource-manager",
5
+ packageRoot: resolvePath(fileURLToPath(import.meta.url), "../../../../"),
6
+ files: [
7
+ {
8
+ realDir: "",
9
+ pattern: "package.json",
10
+ virtualPath: "./node_modules/@azure-tools/typespec-azure-resource-manager",
11
+ },
12
+ {
13
+ realDir: "dist/src",
14
+ pattern: "*.js",
15
+ virtualPath: "./node_modules/@azure-tools/typespec-azure-resource-manager/dist/src",
16
+ },
17
+ {
18
+ realDir: "lib",
19
+ pattern: "*.tsp",
20
+ virtualPath: "./node_modules/@azure-tools/typespec-azure-resource-manager/lib",
21
+ },
22
+ ],
23
+ };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,+BAA+B,GAAwB;IAClE,IAAI,EAAE,8CAA8C;IACpD,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;IACxE,KAAK,EAAE;QACL;YACE,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,cAAc;YACvB,WAAW,EAAE,6DAA6D;SAC3E;QACD;YACE,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,sEAAsE;SACpF;QACD;YACE,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,iEAAiE;SAC/E;KACF;CACF,CAAC"}
@@ -0,0 +1,465 @@
1
+ using TypeSpec.Http;
2
+ using OpenAPI;
3
+ using TypeSpec.Versioning;
4
+
5
+ namespace Azure.ResourceManager.Foundations;
6
+
7
+ @armCommonDefinition
8
+ @doc("""
9
+ A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.
10
+ """)
11
+ model OperationListResult is Azure.Core.Page<Operation>;
12
+
13
+ /**
14
+ * Base model that defines common properties for all ARM resources.
15
+ */
16
+ @doc("Common properties for all ARM resources.")
17
+ model ArmResource {
18
+ @doc("Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}")
19
+ @visibility("read")
20
+ id: string;
21
+ // The name property must be included by the resource type author!
22
+
23
+
24
+ @doc("The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\"")
25
+ @visibility("read")
26
+ type: string;
27
+
28
+ @doc("Azure Resource Manager metadata containing createdBy and modifiedBy information.")
29
+ @visibility("read")
30
+ systemData?: SystemData;
31
+ }
32
+
33
+ /**
34
+ * The base tracked resource.
35
+ */
36
+ @armCommonDefinition("TrackedResource")
37
+ @doc("The resource model definition for an Azure Resource Manager tracked top level resource")
38
+ model TrackedResourceBase extends ArmResource {
39
+ @doc("The geo-location where the resource lives")
40
+ @visibility("read", "create")
41
+ location: string;
42
+ ...ArmTagsProperty;
43
+ }
44
+
45
+ /**
46
+ * The base proxy resource.
47
+ */
48
+ @doc("The base proxy resource.")
49
+ @armCommonDefinition("ProxyResource")
50
+ model ProxyResourceBase extends ArmResource {}
51
+
52
+ /**
53
+ * The base extension resource.
54
+ */
55
+ // Note that ProxyResource is the base definition for both kinds of resources
56
+ @doc("The base extension resource.")
57
+ @armCommonDefinition("ProxyResource")
58
+ model ExtensionResourceBase extends ArmResource {}
59
+
60
+ /**
61
+ * An internal enum to indicate the resource support for various path types
62
+ */
63
+ enum ResourceHome {
64
+ Tenant,
65
+ Subscription,
66
+ Location,
67
+ ResourceGroup,
68
+ Extension,
69
+ }
70
+
71
+ /**
72
+ * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"
73
+ */
74
+ @doc("""
75
+ The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"
76
+ """)
77
+ enum Origin {
78
+ user,
79
+ system,
80
+ `user,system`,
81
+ }
82
+
83
+ /**
84
+ * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
85
+ */
86
+ @doc("""
87
+ Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
88
+ """)
89
+ enum ActionType {
90
+ Internal,
91
+ }
92
+
93
+ @armCommonDefinition
94
+ @doc("Localized display information for and operation.")
95
+ model OperationDisplay {
96
+ @doc("""
97
+ The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute".
98
+ """)
99
+ provider?: string;
100
+
101
+ @doc("""
102
+ The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections".
103
+ """)
104
+ resource?: string;
105
+
106
+ @doc("""
107
+ The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine".
108
+ """)
109
+ operation?: string;
110
+
111
+ @doc("The short, localized friendly description of the operation; suitable for tool tips and detailed views.")
112
+ description?: string;
113
+ }
114
+
115
+ @armCommonDefinition
116
+ @doc("The current status of an async operation.")
117
+ model OperationStatusResult {
118
+ @doc("Fully qualified ID for the async operation.")
119
+ id?: string;
120
+
121
+ @doc("Name of the async operation.")
122
+ name?: string;
123
+
124
+ @doc("Operation status.")
125
+ status: string;
126
+
127
+ @doc("Percent of the operation that is complete.")
128
+ @minValue(0)
129
+ @maxValue(100)
130
+ percentComplete?: int32;
131
+
132
+ @doc("The start time of the operation.")
133
+ startTime?: zonedDateTime;
134
+
135
+ @doc("The end time of the operation.")
136
+ endTime?: zonedDateTime;
137
+
138
+ @doc("The operations list.")
139
+ operations: OperationStatusResult[];
140
+
141
+ @doc("If present, details of the operation error.")
142
+ error?: ErrorDetail;
143
+ }
144
+
145
+ @armCommonDefinition
146
+ @doc("The error detail.")
147
+ model ErrorDetail {
148
+ @doc("The error code.")
149
+ @visibility("read")
150
+ code?: string;
151
+
152
+ @doc("The error message.")
153
+ @visibility("read")
154
+ message?: string;
155
+
156
+ @doc("The error target.")
157
+ @visibility("read")
158
+ target?: string;
159
+
160
+ @extension("x-ms-identifiers", ["message", "target"])
161
+ @doc("The error details.")
162
+ @visibility("read")
163
+ details?: ErrorDetail[];
164
+
165
+ @extension("x-ms-identifiers", ["message", "target"])
166
+ @doc("The error additional info.")
167
+ @visibility("read")
168
+ additionalInfo?: ErrorAdditionalInfo[];
169
+ }
170
+
171
+ @resourceBaseParametersOf(TResource)
172
+ model BaseParameters<TResource extends ArmResource> {
173
+ ...ApiVersionParameter;
174
+ // unless tenant or extension
175
+ ...SubscriptionIdParameter;
176
+ //unless tenant, subscription, resourceGroup, or extension
177
+ ...LocationParameter;
178
+ // unless tenant, subscription, location, or extension
179
+ ...ResourceGroupParameter;
180
+ // unless tenant, subscription, location, or resourceGroup
181
+ ...ResourceUriParameter;
182
+ }
183
+
184
+ // The static parameters for a tenant-based resource
185
+ model TenantBaseParameters {
186
+ ...ApiVersionParameter;
187
+ }
188
+
189
+ // The static parameters for a subscription based resource
190
+ model SubscriptionBaseParameters is TenantBaseParameters {
191
+ ...SubscriptionIdParameter;
192
+ }
193
+
194
+ // The static parameters for a location-based resource
195
+ model LocationBaseParameters is SubscriptionBaseParameters {
196
+ ...LocationParameter;
197
+ }
198
+
199
+ // The static parameters for a resource-group based resource
200
+ model ResourceGroupBaseParameters is SubscriptionBaseParameters {
201
+ ...ResourceGroupParameter;
202
+ }
203
+
204
+ // The static parameters for an extension resource
205
+ model ExtensionBaseParameters is TenantBaseParameters {
206
+ ...ResourceUriParameter;
207
+ }
208
+
209
+ @armCommonDefinition
210
+ @doc("The resource management error additional info.")
211
+ model ErrorAdditionalInfo {
212
+ @doc("The additional info type.")
213
+ @visibility("read")
214
+ type?: string;
215
+
216
+ @doc("The additional info.")
217
+ @visibility("read")
218
+ info?: {};
219
+ }
220
+
221
+ /**
222
+ * Standard type definition for ARM Tags property.
223
+ *
224
+ * It is included in the TrackedResource template definition.
225
+ */
226
+ @doc("The ARM Resource tags.")
227
+ model ArmTagsProperty {
228
+ @doc("Resource tags.")
229
+ tags?: Record<string>;
230
+ }
231
+
232
+ // NOTE: This is how the enum is named in types.json
233
+ @doc("The kind of entity that created the resource.")
234
+ enum createdByType {
235
+ User,
236
+ Application,
237
+ ManagedIdentity,
238
+ Key,
239
+ }
240
+
241
+ @armCommonDefinition("systemData")
242
+ @doc("Metadata pertaining to creation and last modification of the resource.")
243
+ model SystemData {
244
+ @visibility("read")
245
+ @doc("The identity that created the resource.")
246
+ createdBy?: string;
247
+
248
+ @visibility("read")
249
+ @doc("The type of identity that created the resource.")
250
+ createdByType?: createdByType;
251
+
252
+ @visibility("read")
253
+ @doc("The type of identity that created the resource.")
254
+ createdAt?: plainDate;
255
+
256
+ @visibility("read")
257
+ @doc("The identity that last modified the resource.")
258
+ lastModifiedBy?: string;
259
+
260
+ @visibility("read")
261
+ @doc("The type of identity that last modified the resource.")
262
+ lastModifiedByType?: createdByType;
263
+
264
+ @visibility("read")
265
+ @doc("The timestamp of resource last modification (UTC)")
266
+ lastModifiedAt?: plainDate;
267
+ }
268
+
269
+ @armCommonDefinition("ManagedServiceIdentity", "v4", "managedidentity.json")
270
+ @doc("The properties of the managed service identities assigned to this resource.")
271
+ model ManagedIdentityProperties {
272
+ @doc("The Active Directory tenant id of the principal.")
273
+ @visibility("read")
274
+ tenantId?: string;
275
+
276
+ @doc("The active directory identifier of this principal.")
277
+ @visibility("read")
278
+ principalId?: string;
279
+
280
+ @doc("The type of managed identity assigned to this resource.")
281
+ type: ManagedIdentityType;
282
+
283
+ @doc("The identities assigned to this resource by the user.")
284
+ userAssignedIdentities?: Record<UserAssignedIdentity>;
285
+ }
286
+
287
+ @armCommonDefinition("SystemAssignedServiceIdentity", "v4", "managedidentity.json")
288
+ @doc("The properties of the service-assigned identity associated with this resource.")
289
+ model ManagedSystemIdentityProperties {
290
+ @doc("The Active Directory tenant id of the principal.")
291
+ @visibility("read")
292
+ tenantId?: string;
293
+
294
+ @doc("The active directory identifier of this principal.")
295
+ @visibility("read")
296
+ principalId?: string;
297
+
298
+ @doc("The type of managed identity assigned to this resource.")
299
+ type: ManagedSystemIdentityType;
300
+ }
301
+
302
+ @doc("A managed identity assigned by the user.")
303
+ model UserAssignedIdentity {
304
+ @doc("The active directory client identifier for this principal.")
305
+ clientId?: string;
306
+
307
+ @doc("The active directory identifier for this principal.")
308
+ principalId?: string;
309
+ }
310
+
311
+ @doc("The kind of managed identity assigned to this resource.")
312
+ enum ManagedIdentityType {
313
+ None,
314
+ SystemAssigned,
315
+ UserAssigned,
316
+ SystemAndUserAssigned: "SystemAssigned, UserAssigned",
317
+ }
318
+
319
+ @doc("The kind of managemed identity assigned to this resource.")
320
+ enum ManagedSystemIdentityType {
321
+ None,
322
+ SystemAssigned,
323
+ }
324
+
325
+ // Defines a properties type used to create named resource update models.
326
+ // This type is not used directly, it is referenced by ResourceUpdateModel<T>.
327
+ @doc("The updatable properties of the {name}.", TResource)
328
+ @friendlyName("{name}UpdateProperties", TResource)
329
+ model ResourceUpdateModelProperties<TResource extends ArmResource, TProperties extends object>
330
+ is OptionalProperties<UpdateableProperties<TProperties>>;
331
+
332
+ // Defines a model type used to create named resource update models
333
+ // e.g. `model MyResourceUpdate is ResourceUpdate<MyResourceProperties> {}`
334
+ @doc("The type used for update operations of the {name}.", TResource)
335
+ @friendlyName("{name}Update", TResource)
336
+ @omitIfEmpty("properties")
337
+ model ResourceUpdateModel<TResource extends ArmResource, TProperties extends object>
338
+ is OptionalProperties<UpdateableProperties<OmitProperties<TResource, "Name" | "name">>> {
339
+ @extension("x-ms-client-flatten", true)
340
+ properties?: ResourceUpdateModelProperties<TResource, TProperties>;
341
+ }
342
+
343
+ @doc("The type used for updating tags in {name} resources.", TResource)
344
+ @friendlyName("{name}TagsUpdate", TResource)
345
+ model TagsUpdateModel<TResource extends ArmResource> {
346
+ ...ArmTagsProperty;
347
+ }
348
+
349
+ // Tenant resource operation definitions
350
+
351
+ alias TenantParentScope<TResource extends ArmResource> = TenantScope<TResource>;
352
+
353
+ // Parameter model for listing a resource at the tenant scope
354
+ model TenantScope<TResource extends ArmResource>
355
+ is ResourceParentParameters<TResource, TenantBaseParameters>;
356
+
357
+ // Parameter model for listing a resource at the subscription scope
358
+ model SubscriptionScope<TResource extends ArmResource>
359
+ is ResourceParentParameters<TResource, SubscriptionBaseParameters>;
360
+
361
+ // Parameter model for listing a resource at the location scope
362
+ model LocationScope<TResource extends ArmResource>
363
+ is ResourceParentParameters<TResource, LocationBaseParameters>;
364
+
365
+ // Parameter model for listing an extension resource
366
+ model ExtensionScope<TResource extends ArmResource>
367
+ is ResourceParentParameters<TResource, ExtensionBaseParameters>;
368
+
369
+ // Parameter model for listing a resource at the resource group scope
370
+ model ResourceGroupScope<TResource extends ArmResource> is ResourceParentParameters<TResource>;
371
+
372
+ @doc("Details of the resource plan.")
373
+ @armCommonDefinition("Plan")
374
+ model ResourcePlanType {
375
+ @doc("A user defined name of the 3rd Party Artifact that is being procured.")
376
+ name: string;
377
+
378
+ @doc("The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic")
379
+ publisher: string;
380
+
381
+ @doc("The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. ")
382
+ product: string;
383
+
384
+ @doc("A publisher provided promotion code as provisioned in Data Market for the said product/artifact.")
385
+ promotionCode?: string;
386
+
387
+ @doc("The version of the desired product/artifact.")
388
+ version?: string;
389
+ }
390
+
391
+ @doc("The SKU (Stock Keeping Unit) assigned to this resource.")
392
+ @armCommonDefinition("Sku")
393
+ model ResourceSkuType {
394
+ @doc("The name of the SKU, usually a combination of letters and numbers, for example, 'P3'")
395
+ name: string;
396
+
397
+ @doc("This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT.")
398
+ tier?: SkuTier;
399
+
400
+ @doc("The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code.")
401
+ size?: string;
402
+
403
+ @doc("If the service has different generations of hardware, for the same SKU, then that can be captured here.")
404
+ family?: string;
405
+
406
+ @doc("If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted.")
407
+ capacity?: int32;
408
+ }
409
+
410
+ @doc("Available service tiers for the SKU.")
411
+ enum SkuTier {
412
+ Free,
413
+ Basic,
414
+ Standard,
415
+ Premium,
416
+ }
417
+
418
+ @doc("The type used for update operations of the {name}.", TResource)
419
+ @friendlyName("{name}Update", TResource)
420
+ model ProxyResourceUpdateModel<TResource extends ArmResource, TProperties extends object> {
421
+ @extension("x-ms-client-flatten", true)
422
+ properties?: ResourceUpdateModelProperties<TResource, TProperties>;
423
+ }
424
+
425
+ /**
426
+ * Details of a REST API operation, returned from the Resource Provider Operations API
427
+ */
428
+ @armCommonDefinition
429
+ @doc("Details of a REST API operation, returned from the Resource Provider Operations API")
430
+ model Operation {
431
+ @doc("""
432
+ The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action"
433
+ """)
434
+ @visibility("read")
435
+ name?: string;
436
+
437
+ @doc("""
438
+ Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations.
439
+ """)
440
+ @visibility("read")
441
+ isDataAction?: boolean;
442
+
443
+ @doc("Localized display information for this particular operation.")
444
+ display?: OperationDisplay;
445
+
446
+ @doc("""
447
+ The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"
448
+ """)
449
+ @visibility("read")
450
+ origin?: Origin;
451
+
452
+ @doc("""
453
+ Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
454
+ """)
455
+ actionType?: ActionType;
456
+ }
457
+
458
+ @doc("The default operationId parameter type.")
459
+ model OperationIdParameter {
460
+ @path
461
+ @minLength(1)
462
+ @doc("The ID of an ongoing async operation.")
463
+ @armCommonParameter("OperationIdParameter")
464
+ operationId: string;
465
+ }
package/lib/arm.tsp ADDED
@@ -0,0 +1,31 @@
1
+ import "../dist/src/index.js";
2
+ import "../dist/src/internal.js";
3
+ import "@typespec/openapi";
4
+ import "@typespec/http";
5
+ import "@typespec/rest";
6
+ import "@typespec/versioning";
7
+ import "@azure-tools/typespec-autorest";
8
+ import "@azure-tools/typespec-azure-core";
9
+
10
+ import "./arm.foundations.tsp";
11
+ import "./models.tsp";
12
+ import "./operations.tsp";
13
+ import "./decorators.tsp";
14
+ import "./interfaces.tsp";
15
+ import "./responses.tsp";
16
+ import "./parameters.tsp";
17
+
18
+ using TypeSpec.Http;
19
+ using TypeSpec.Rest;
20
+ using TypeSpec.Versioning;
21
+ using OpenAPI;
22
+ using Autorest;
23
+ using Azure.ResourceManager.Foundations;
24
+
25
+ @versioned(Azure.ResourceManager.Versions)
26
+ namespace Azure.ResourceManager;
27
+
28
+ enum Versions {
29
+ @useDependency(Azure.Core.Versions.v1_0_Preview_1)
30
+ v1_0_Preview_1: "1.0-preview.1",
31
+ }