@azure-tools/typespec-azure-resource-manager 0.40.0-dev.8 → 0.40.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.
package/README.md CHANGED
@@ -28,33 +28,34 @@ Available ruleSets:
28
28
 
29
29
  ### Rules
30
30
 
31
- | Name | Description |
32
- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
33
- | [`@azure-tools/typespec-azure-resource-manager/arm-no-record`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/no-record) | Don't use Record types for ARM resources. |
34
- | `@azure-tools/typespec-azure-resource-manager/arm-common-types-version` | Specify the ARM common-types version using @armCommonTypesVersion. |
35
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-action-no-segment` | `@armResourceAction` should not be used with `@segment`. |
36
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property` | Warn about duplicate properties in resources. |
37
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property` | Check for invalid resource envelope properties. |
38
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-version-format` | Check for valid versions. |
39
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-key-invalid-chars` | Arm resource key must contain only alphanumeric characters. |
40
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-operation-response` | [RPC 008]: PUT, GET, PATCH & LIST must return the same resource schema. |
41
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-path-segment-invalid-chars` | Arm resource name must contain only alphanumeric characters. |
42
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state` | Check for properly configured provisioningState property. |
43
- | `@azure-tools/typespec-azure-resource-manager/beyond-nesting-levels` | Tracked Resources must use 3 or fewer levels of nesting. |
44
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-operation` | Validate ARM Resource operations. |
45
- | `@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation` | Check for resources that must have a delete operation. |
46
- | `@azure-tools/typespec-azure-resource-manager/empty-updateable-properties` | Should have updateable properties. |
47
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator` | Each resource interface must have an @armResourceOperations decorator. |
48
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-action-verb` | Actions must be HTTP Post operations. |
49
- | `@azure-tools/typespec-azure-resource-manager/improper-subscription-list-operation` | Tenant and Extension resources should not define a list by subscription operation. |
50
- | [`@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/missing-x-ms-identifiers) | Azure services should not use enums. |
51
- | `@azure-tools/typespec-azure-resource-manager/no-response-body` | The body of 202 response should be empty. |
52
- | `@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint` | Check for missing Operations interface. |
53
- | `@azure-tools/typespec-azure-resource-manager/patch-envelope` | Patch envelope properties should match the resource properties. |
54
- | `@azure-tools/typespec-azure-resource-manager/arm-resource-patch` | Validate ARM PATCH operations. |
55
- | `@azure-tools/typespec-azure-resource-manager/resource-name` | Check the resource name. |
56
- | `@azure-tools/typespec-azure-resource-manager/retry-after` | Check if retry-after header appears in response body. |
57
- | [`@azure-tools/typespec-azure-resource-manager/unsupported-type`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/unsupported-type) | Check for unsupported ARM types. |
31
+ | Name | Description |
32
+ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
33
+ | [`@azure-tools/typespec-azure-resource-manager/arm-no-record`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/no-record) | Don't use Record types for ARM resources. |
34
+ | `@azure-tools/typespec-azure-resource-manager/arm-common-types-version` | Specify the ARM common-types version using @armCommonTypesVersion. |
35
+ | [`@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/delete-operation-response-codes) | Ensure delete operations have the appropriate status codes. |
36
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-action-no-segment` | `@armResourceAction` should not be used with `@segment`. |
37
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property` | Warn about duplicate properties in resources. |
38
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property` | Check for invalid resource envelope properties. |
39
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-version-format` | Check for valid versions. |
40
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-key-invalid-chars` | Arm resource key must contain only alphanumeric characters. |
41
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-operation-response` | [RPC 008]: PUT, GET, PATCH & LIST must return the same resource schema. |
42
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-path-segment-invalid-chars` | Arm resource name must contain only alphanumeric characters. |
43
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state` | Check for properly configured provisioningState property. |
44
+ | `@azure-tools/typespec-azure-resource-manager/beyond-nesting-levels` | Tracked Resources must use 3 or fewer levels of nesting. |
45
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-operation` | Validate ARM Resource operations. |
46
+ | `@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation` | Check for resources that must have a delete operation. |
47
+ | `@azure-tools/typespec-azure-resource-manager/empty-updateable-properties` | Should have updateable properties. |
48
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator` | Each resource interface must have an @armResourceOperations decorator. |
49
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-action-verb` | Actions must be HTTP Post operations. |
50
+ | `@azure-tools/typespec-azure-resource-manager/improper-subscription-list-operation` | Tenant and Extension resources should not define a list by subscription operation. |
51
+ | [`@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/missing-x-ms-identifiers) | Azure services should not use enums. |
52
+ | `@azure-tools/typespec-azure-resource-manager/no-response-body` | The body of 202 response should be empty. |
53
+ | `@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint` | Check for missing Operations interface. |
54
+ | `@azure-tools/typespec-azure-resource-manager/patch-envelope` | Patch envelope properties should match the resource properties. |
55
+ | `@azure-tools/typespec-azure-resource-manager/arm-resource-patch` | Validate ARM PATCH operations. |
56
+ | `@azure-tools/typespec-azure-resource-manager/resource-name` | Check the resource name. |
57
+ | `@azure-tools/typespec-azure-resource-manager/retry-after` | Check if retry-after header appears in response body. |
58
+ | [`@azure-tools/typespec-azure-resource-manager/unsupported-type`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/unsupported-type) | Check for unsupported ARM types. |
58
59
 
59
60
  ## Decorators
60
61
 
@@ -1 +1 @@
1
- {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AA2DA,eAAO,MAAM,OAAO,+CAmBlB,CAAC"}
1
+ {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AA6DA,eAAO,MAAM,OAAO,+CAmBlB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { defineLinter } from "@typespec/compiler";
2
2
  import { armCommonTypesVersionRule } from "./rules/arm-common-types-version.js";
3
+ import { armDeleteResponseCodesRule } from "./rules/arm-delete-response-codes.js";
3
4
  import { armNoRecordRule } from "./rules/arm-no-record.js";
4
5
  import { armResourceActionNoSegmentRule } from "./rules/arm-resource-action-no-segment.js";
5
6
  import { armResourceDuplicatePropertiesRule } from "./rules/arm-resource-duplicate-property.js";
@@ -27,6 +28,7 @@ import { unsupportedTypeRule } from "./rules/unsupported-type.js";
27
28
  const rules = [
28
29
  armNoRecordRule,
29
30
  armCommonTypesVersionRule,
31
+ armDeleteResponseCodesRule,
30
32
  armResourceActionNoSegmentRule,
31
33
  armResourceDuplicatePropertiesRule,
32
34
  armResourceEnvelopeProperties,
@@ -1 +1 @@
1
- {"version":3,"file":"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,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,MAAM,KAAK,GAAG;IACZ,eAAe;IACf,yBAAyB;IACzB,0BAA0B;IAC1B,8BAA8B;IAC9B,kCAAkC;IAClC,6BAA6B;IAC7B,mCAAmC;IACnC,8BAA8B;IAC9B,yBAAyB;IACzB,+BAA+B;IAC/B,gCAAgC;IAChC,iBAAiB;IACjB,kBAAkB;IAClB,0BAA0B;IAC1B,uBAAuB;IACvB,cAAc;IACd,qBAAqB;IACrB,sBAAsB;IACtB,yBAAyB;IACzB,kBAAkB;IAClB,8BAA8B;IAC9B,4BAA4B;IAC5B,mBAAmB;IACnB,gBAAgB;IAChB,cAAc;IACd,mBAAmB;CACpB,CAAC;AAEF,MAAM,eAAe,GAAG,MAAM,CAAC,WAAW,CACxC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,gDAAgD,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CACzF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;IAClC,KAAK;IACL,QAAQ,EAAE;QACR,GAAG,EAAE;YACH,OAAO,EAAE;gBACP,sCAAsC;gBACtC,uDAAuD;aACxD;YACD,MAAM,EAAE;gBACN,GAAG,eAAe;gBAClB,+EAA+E;gBAC/E,CAAC,gDAAgD,yBAAyB,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK;aAC1F;YACD,OAAO,EAAE;gBACP,CAAC,kDAAkD,CAAC,EAClD,6CAA6C;aAChD;SACF;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Verify that a delete operation only
3
+ */
4
+ export declare const armDeleteResponseCodesRule: import("@typespec/compiler").LinterRuleDefinition<"arm-delete-operation-response-codes", {
5
+ readonly sync: "Synchronous delete operations must have 200, 204 and default responses. They must not have any other responses. Consider using the 'ArmResourceDeleteSync' template.";
6
+ readonly async: "Long-running delete operations must have 202, 204 and default responses. They must not have any other responses. Consider using the 'ArmResourceDeleteWithoutOkAsync' template.";
7
+ }>;
8
+ //# sourceMappingURL=arm-delete-response-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arm-delete-response-codes.d.ts","sourceRoot":"","sources":["../../../src/rules/arm-delete-response-codes.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;EAmCrC,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { createRule } from "@typespec/compiler";
2
+ import { getLroMetadata } from "@azure-tools/typespec-azure-core";
3
+ import { getHttpOperation } from "@typespec/http";
4
+ import { getArmResources } from "../resource.js";
5
+ /**
6
+ * Verify that a delete operation only
7
+ */
8
+ export const armDeleteResponseCodesRule = createRule({
9
+ name: "arm-delete-operation-response-codes",
10
+ severity: "warning",
11
+ url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/delete-operation-response-codes",
12
+ description: "Ensure delete operations have the appropriate status codes.",
13
+ messages: {
14
+ sync: `Synchronous delete operations must have 200, 204 and default responses. They must not have any other responses. Consider using the 'ArmResourceDeleteSync' template.`,
15
+ async: `Long-running delete operations must have 202, 204 and default responses. They must not have any other responses. Consider using the 'ArmResourceDeleteWithoutOkAsync' template.`,
16
+ },
17
+ create(context) {
18
+ return {
19
+ model: (model) => {
20
+ const resources = getArmResources(context.program);
21
+ const armResource = resources.find((re) => re.typespecType === model);
22
+ if (armResource && armResource.operations.lifecycle.delete) {
23
+ const deleteOperation = armResource.operations.lifecycle.delete;
24
+ const isAsync = getLroMetadata(context.program, deleteOperation.operation) !== undefined;
25
+ const [httpOp, _] = getHttpOperation(context.program, deleteOperation.operation);
26
+ const statusCodes = new Set([...httpOp.responses.map((r) => r.statusCodes.toString())]);
27
+ const expected = new Set(["204", "*"]);
28
+ expected.add(isAsync ? "202" : "200");
29
+ if (statusCodes.size !== expected.size ||
30
+ ![...statusCodes].every((v) => expected.has(v))) {
31
+ context.reportDiagnostic({
32
+ target: deleteOperation.operation,
33
+ messageId: isAsync ? "async" : "sync",
34
+ });
35
+ }
36
+ }
37
+ },
38
+ };
39
+ },
40
+ });
41
+ //# sourceMappingURL=arm-delete-response-codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arm-delete-response-codes.js","sourceRoot":"","sources":["../../../src/rules/arm-delete-response-codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;IACnD,IAAI,EAAE,qCAAqC;IAC3C,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,oHAAoH;IACzH,WAAW,EAAE,6DAA6D;IAC1E,QAAQ,EAAE;QACR,IAAI,EAAE,sKAAsK;QAC5K,KAAK,EAAE,iLAAiL;KACzL;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE;gBACtB,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACnD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC;gBACtE,IAAI,WAAW,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;oBAC3D,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;oBAChE,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC;oBACzF,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;oBACjF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;oBACxF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;oBACvC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;oBAEtC,IACE,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI;wBAClC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAC/C,CAAC;wBACD,OAAO,CAAC,gBAAgB,CAAC;4BACvB,MAAM,EAAE,eAAe,CAAC,SAAS;4BACjC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;yBACtC,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1,5 +1,7 @@
1
1
  export declare const armResourceProvisioningStateRule: import("@typespec/compiler").LinterRuleDefinition<"arm-resource-provisioning-state", {
2
2
  readonly default: "The RP-specific property model in the 'properties' property of this resource must contain a 'provisioningState property. The property type should be an enum or a union of string values, and it must specify known state values 'Succeeded', 'Failed', and 'Canceled'.";
3
3
  readonly missingValues: import("@typespec/compiler").CallableMessage<[string]>;
4
+ readonly missingReadOnlyVisibility: "The provisioningState property must have a single read visibility.";
5
+ readonly mustBeOptional: "The provisioningState property must be optional.";
4
6
  }>;
5
7
  //# sourceMappingURL=arm-resource-provisioning-state-rule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"arm-resource-provisioning-state-rule.d.ts","sourceRoot":"","sources":["../../../src/rules/arm-resource-provisioning-state-rule.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gCAAgC;;;EAwF3C,CAAC"}
1
+ {"version":3,"file":"arm-resource-provisioning-state-rule.d.ts","sourceRoot":"","sources":["../../../src/rules/arm-resource-provisioning-state-rule.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,gCAAgC;;;;;EA8G3C,CAAC"}
@@ -1,4 +1,4 @@
1
- import { createRule, getProperty, paramMessage } from "@typespec/compiler";
1
+ import { createRule, getProperty, getVisibility, paramMessage, } from "@typespec/compiler";
2
2
  import { getUnionAsEnum } from "@azure-tools/typespec-azure-core";
3
3
  import { getArmResource } from "../resource.js";
4
4
  import { getSourceProperty } from "./utils.js";
@@ -9,6 +9,8 @@ export const armResourceProvisioningStateRule = createRule({
9
9
  messages: {
10
10
  default: "The RP-specific property model in the 'properties' property of this resource must contain a 'provisioningState property. The property type should be an enum or a union of string values, and it must specify known state values 'Succeeded', 'Failed', and 'Canceled'.",
11
11
  missingValues: paramMessage `The "@knownValues" decorator for provisioningState, must reference an enum with 'Succeeded', 'Failed', 'Canceled' values. The enum is missing the values: [${"missingValues"}].`,
12
+ missingReadOnlyVisibility: "The provisioningState property must have a single read visibility.",
13
+ mustBeOptional: "The provisioningState property must be optional.",
12
14
  },
13
15
  create(context) {
14
16
  return {
@@ -85,6 +87,21 @@ export const armResourceProvisioningStateRule = createRule({
85
87
  target: provisioning,
86
88
  });
87
89
  }
90
+ // validate provisioning state is optional
91
+ if (provisioning.optional !== true) {
92
+ context.reportDiagnostic({
93
+ messageId: "mustBeOptional",
94
+ target: provisioning,
95
+ });
96
+ }
97
+ // validate it must has a read only visibility
98
+ const visibilities = getVisibility(context.program, provisioning);
99
+ if (!(visibilities !== undefined && visibilities.length === 1 && visibilities[0] === "read")) {
100
+ context.reportDiagnostic({
101
+ messageId: "missingReadOnlyVisibility",
102
+ target: provisioning,
103
+ });
104
+ }
88
105
  }
89
106
  },
90
107
  };
@@ -1 +1 @@
1
- {"version":3,"file":"arm-resource-provisioning-state-rule.js","sourceRoot":"","sources":["../../../src/rules/arm-resource-provisioning-state-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAExF,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,gCAAgC,GAAG,UAAU,CAAC;IACzD,IAAI,EAAE,iCAAiC;IACvC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,2DAA2D;IACxE,QAAQ,EAAE;QACR,OAAO,EACL,0QAA0Q;QAC5Q,aAAa,EAAE,YAAY,CAAA,8JAA8J,eAAe,IAAI;KAC7M;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE;;gBACtB,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC7D,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;oBAChC,OAAO;gBACT,CAAC;gBACD,MAAM,kBAAkB,GAAG,MAAA,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,0CAAE,IAAI,CAAC;gBAClE,IAAI,kBAAkB,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBAC5E,OAAO;gBACT,CAAC;gBA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C;4BACb,MAAM,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,gBAAgB,CAAC,CAAC;4BACvD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gCAC9B,OAAO,CAAC,gBAAgB,CAAC;oCACvB,MAAM,EAAE,kBAAkB;iCAC3B,CAAC,CAAC;gCACH,MAAM;4BACR,CAAC;4BACD,MAAM,OAAO,GAAa,EAAE,CAAC;4BAC7B,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;gCACnD,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;4BAC5B,CAAC;4BACD,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gCAClD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;4BAC3B,CAAC;4BACD,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gCAChD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;4BACzB,CAAC;4BACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gCACvB,OAAO,CAAC,gBAAgB,CAAC;oCACvB,SAAS,EAAE,eAAe;oCAC1B,MAAM,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oCAC7C,MAAM,EAAE,gBAAgB;iCACzB,CAAC,CAAC;4BACL,CAAC;4BACD,MAAM;wBACR,CAAC;wBAED;4BACE,OAAO,CAAC,gBAAgB,CAAC;gCACvB,MAAM,EAAE,YAAY;6BACrB,CAAC,CAAC;oBACP,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"arm-resource-provisioning-state-rule.js","sourceRoot":"","sources":["../../../src/rules/arm-resource-provisioning-state-rule.ts"],"names":[],"mappings":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,gBAAgB,CAAC;4BACvB,SAAS,EAAE,2BAA2B;4BACtC,MAAM,EAAE,YAAY;yBACrB,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -753,7 +753,7 @@ op checkNameAvailability<
753
753
  ): Response | ErrorResponse;
754
754
 
755
755
  /**
756
- * @dev The base template for Azure Resource Manager GET Operations.
756
+ * @dev The base template for Azure Resource Manager GET and HEAD Operations.
757
757
  * @param Parameters The parameter object for the operation.
758
758
  * @param Response The response or union of responses for success.
759
759
  * @param ErrorResponse The error response.
@@ -77,6 +77,7 @@ interface TrackedResourceOperations<
77
77
  * @template Resource the ArmResource that provides these operations
78
78
  * @template BaseParameters The http parameters that are part of the request
79
79
  */
80
+ #suppress "deprecated" "This should be deprecated in a future release"
80
81
  interface ProxyResourceOperations<
81
82
  Resource extends ArmResource,
82
83
  BaseParameters = DefaultBaseParameters<Resource>
@@ -97,6 +98,7 @@ interface ProxyResourceOperations<
97
98
  * @template Resource the ArmResource that provides these operations
98
99
  * @template Properties RP-specific property bag for the resource
99
100
  */
101
+ #suppress "deprecated" "This should be deprecated in a future release"
100
102
  interface TenantResourceOperations<
101
103
  Resource extends ArmResource,
102
104
  Properties extends TypeSpec.Reflection.Model
@@ -114,6 +116,7 @@ interface TenantResourceOperations<
114
116
  * @template BaseParameters The http parameters that are part of the request
115
117
  * @template PatchModel The model used for PATCH operations
116
118
  */
119
+ #suppress "deprecated" "This should be deprecated in a future release"
117
120
  interface ResourceInstanceOperations<
118
121
  Resource extends ArmResource,
119
122
  Properties extends TypeSpec.Reflection.Model,
@@ -227,6 +230,7 @@ interface ResourceCreateAsync<
227
230
  * @template Resource The ArmResource that provides these operations
228
231
  * @template BaseParameters The http parameters that are part of the request
229
232
  */
233
+ #deprecated "This should be deprecated in a future release"
230
234
  @doc("Delete a resource using the asynchronous call pattern")
231
235
  interface ResourceDeleteAsync<
232
236
  Resource extends ArmResource,
@@ -327,6 +331,7 @@ interface ResourceUpdateSync<
327
331
  * @template Resource The ArmResource that provides these operations
328
332
  * @template Properties RP-specific property bag for the resource
329
333
  */
334
+ #suppress "deprecated" "This should be deprecated in a future release"
330
335
  interface ExtensionResourceInstanceOperations<
331
336
  Resource extends ArmResource,
332
337
  Properties extends TypeSpec.Reflection.Model
@@ -366,6 +371,7 @@ alias ResourceUpdate<
366
371
  BaseParameters = DefaultBaseParameters<Resource>
367
372
  > = ResourceUpdateSync<Resource, Properties, BaseParameters>;
368
373
 
374
+ #suppress "deprecated" "This should be deprecated in a future release"
369
375
  alias ResourceDelete<
370
376
  Resource extends ArmResource,
371
377
  BaseParameters = DefaultBaseParameters<Resource>
@@ -391,6 +397,7 @@ alias ExtensionResourceUpdate<
391
397
  Properties extends TypeSpec.Reflection.Model
392
398
  > = ResourceUpdate<Resource, Properties, ExtensionBaseParameters>;
393
399
 
400
+ #suppress "deprecated" "This should be deprecated in a future release"
394
401
  alias ExtensionResourceDelete<Resource extends ArmResource> = ResourceDelete<
395
402
  Resource,
396
403
  ExtensionBaseParameters
@@ -413,6 +420,7 @@ alias TenantResourceCreate<Resource extends ArmResource> = ResourceCreateAsync<
413
420
  TenantBaseParameters
414
421
  >;
415
422
 
423
+ #suppress "deprecated" "This should be deprecated in a future release"
416
424
  alias TenantResourceDelete<Resource extends ArmResource> = ResourceDelete<
417
425
  Resource,
418
426
  TenantBaseParameters
package/lib/models.tsp CHANGED
@@ -1,6 +1,7 @@
1
1
  using TypeSpec.Http;
2
2
  using TypeSpec.Rest;
3
3
  using TypeSpec.OpenAPI;
4
+ using Azure.Core;
4
5
  using Azure.ResourceManager.Foundations;
5
6
  using Azure.ResourceManager.Private;
6
7
 
@@ -169,7 +170,8 @@ enum ResourceProvisioningState {
169
170
  @doc("Contains a default provisioningState property to be spread into resource property types")
170
171
  model DefaultProvisioningStateProperty {
171
172
  @doc("The provisioning state of the resource.")
172
- provisioningState: ResourceProvisioningState;
173
+ @visibility("read")
174
+ provisioningState?: ResourceProvisioningState;
173
175
  }
174
176
 
175
177
  /**
@@ -55,7 +55,7 @@ op ArmResourceListByParent<
55
55
  > is ArmReadOperation<
56
56
  ResourceParentParameters<Resource, BaseParameters> & Parameters,
57
57
  Response,
58
- ErrorResponse
58
+ Error
59
59
  >;
60
60
 
61
61
  /**
@@ -81,12 +81,12 @@ op ArmResourceListAtScope<
81
81
  > is ArmReadOperation<
82
82
  ResourceParentParameters<Resource, BaseParameters> & Parameters,
83
83
  Response,
84
- ErrorResponse
84
+ Error
85
85
  >;
86
86
 
87
87
  /**
88
88
  * A resource GET operation
89
- * @template Resource the resource being patched
89
+ * @template Resource the resource being read
90
90
  * @template BaseParameters Optional. Allows overriding the operation parameters
91
91
  * @template Parameters Optional. Additional parameters after the path parameters
92
92
  * @template Response Optional. The success response for the read operation
@@ -105,12 +105,35 @@ op ArmResourceRead<
105
105
  > is ArmReadOperation<
106
106
  ResourceInstanceParameters<Resource, BaseParameters> & Parameters,
107
107
  Response,
108
- ErrorResponse
108
+ Error
109
+ >;
110
+
111
+ /**
112
+ * Check a resource's existence via HEAD operation
113
+ * @template Resource the resource being checked
114
+ * @template BaseParameters Optional. Allows overriding the operation parameters
115
+ * @template Parameters Optional. Additional parameters after the path parameters
116
+ * @template Response Optional. The success response for the read operation
117
+ * @template Error Optional. The error response, if non-standard.
118
+ */
119
+ @autoRoute
120
+ @doc("Check for the existence of a {name}", Resource)
121
+ @head
122
+ op ArmResourceCheckExistence<
123
+ Resource extends ArmResourceBase,
124
+ BaseParameters = DefaultBaseParameters<Resource>,
125
+ Parameters extends {} = {},
126
+ Response extends {} = ArmResourceExistsResponse | ArmResourceNotFoundResponse,
127
+ Error extends {} = ErrorResponse
128
+ > is ArmReadOperation<
129
+ ResourceInstanceParameters<Resource, BaseParameters> & Parameters,
130
+ Response,
131
+ Error
109
132
  >;
110
133
 
111
134
  /**
112
135
  * A long-running resource CreateOrUpdate (PUT)
113
- * @template Resource the resource being patched
136
+ * @template Resource the resource being created or updated
114
137
  * @template BaseParameters Optional. Allows overriding the operation parameters
115
138
  * @template LroHeaders Optional. Allows overriding the lro headers returned on resource create
116
139
  * @template Parameters Optional. Additional parameters after the path parameters
@@ -141,13 +164,13 @@ op ArmResourceCreateOrUpdateAsync<
141
164
  > is ArmCreateOperation<
142
165
  ResourceInstanceParameters<Resource, BaseParameters> & Parameters,
143
166
  Resource,
144
- ArmResourceUpdatedResponse<Resource> | ArmResourceCreatedResponse<Resource, LroHeaders>,
167
+ Response,
145
168
  Error
146
169
  >;
147
170
 
148
171
  /**
149
172
  * DEPRECATED: Please use ArmResourceCreateOrReplaceSync instead
150
- * @template Resource the resource being patched
173
+ * @template Resource the resource being created or updated
151
174
  * @template BaseParameters Optional. Allows overriding the operation parameters
152
175
  * @template Parameters Optional. Additional parameters after the path parameters
153
176
  * @template Response Optional. The success response for the createOrUpdate operation
@@ -173,7 +196,7 @@ op ArmResourceCreateOrUpdateSync<
173
196
 
174
197
  /**
175
198
  * Synchronous PUT operation for Azure Resource Manager resources
176
- * @template Resource the resource being patched
199
+ * @template Resource the resource being created or replaced
177
200
  * @template BaseParameters Optional. Allows overriding the operation parameters
178
201
  * @template Parameters Optional. Additional parameters after the path parameters
179
202
  * @template Response Optional. The success response for the createOrUpdate operation
@@ -198,7 +221,7 @@ op ArmResourceCreateOrReplaceSync<
198
221
 
199
222
  /**
200
223
  * @dev A long-running resource CreateOrUpdate (PUT)
201
- * @template Resource the resource being patched
224
+ * @template Resource the resource being created or replaced
202
225
  * @template BaseParameters Optional. Allows overriding the operation parameters
203
226
  * @template LroHeaders Optional. Allows overriding the lro headers returned on resource create
204
227
  * @template Parameters Optional. Additional parameters after the path parameters
@@ -412,6 +435,7 @@ op ArmResourceDeleteAsyncBase<
412
435
  * @template Response Optional. The success response(s) for the delete operation
413
436
  * @template Error Optional. The error response, if non-standard.
414
437
  */
438
+ #deprecated "Use 'ArmResourceDeleteWithoutOkAsync' instead"
415
439
  op ArmResourceDeleteAsync<
416
440
  Resource extends ArmResource,
417
441
  BaseParameters = DefaultBaseParameters<Resource>,
@@ -568,17 +592,16 @@ op ArmResourceActionNoContentAsync<
568
592
  Resource extends ArmResource,
569
593
  Request extends TypeSpec.Reflection.Model | void,
570
594
  BaseParameters extends TypeSpec.Reflection.Model = DefaultBaseParameters<Resource>,
571
- LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader<
572
- Azure.Core.StatusMonitorPollingOptions<ArmOperationStatus>,
573
- void,
574
- string
575
- >,
595
+ LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader,
576
596
  Parameters extends {} = {},
577
597
  Error extends {} = ErrorResponse
578
598
  > is ArmResourceActionAsyncBase<
579
599
  Resource,
580
600
  Request,
581
- ArmAcceptedLroResponse | ArmNoContentResponse<"Action completed successfully.">,
601
+ ArmAcceptedLroResponse<
602
+ "Resource operation accepted.",
603
+ LroHeaders
604
+ > | ArmNoContentResponse<"Action completed successfully.">,
582
605
  BaseParameters,
583
606
  Parameters,
584
607
  Error
package/lib/responses.tsp CHANGED
@@ -237,3 +237,19 @@ model ErrorResponse {
237
237
  @doc("The error object.")
238
238
  error?: ErrorDetail;
239
239
  }
240
+
241
+ /**
242
+ * @dev Resource exists response
243
+ */
244
+ @doc("The Azure resource exists")
245
+ model ArmResourceExistsResponse {
246
+ ...NoContentResponse;
247
+ }
248
+
249
+ /**
250
+ * @dev Resource is not found response
251
+ */
252
+ @doc("The Azure resource is not found")
253
+ model ArmResourceNotFoundResponse {
254
+ ...NotFoundResponse;
255
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-resource-manager",
3
- "version": "0.40.0-dev.8",
3
+ "version": "0.40.0",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Resource Manager library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -39,26 +39,16 @@
39
39
  "!dist/test/**"
40
40
  ],
41
41
  "peerDependencies": {
42
- "@azure-tools/typespec-autorest": "~0.39.2 || >=0.40.0-dev <0.40.0",
43
- "@azure-tools/typespec-azure-core": "~0.39.1 || >=0.40.0-dev <0.40.0",
44
- "@typespec/compiler": "~0.53.1 || >=0.54.0-dev <0.54.0",
45
- "@typespec/http": "~0.53.0 || >=0.54.0-dev <0.54.0",
46
- "@typespec/openapi": "~0.53.0 || >=0.54.0-dev <0.54.0",
47
- "@typespec/rest": "~0.53.0 || >=0.54.0-dev <0.54.0",
48
- "@typespec/versioning": "~0.53.0 || >=0.54.0-dev <0.54.0"
42
+ "@azure-tools/typespec-autorest": "~0.40.0",
43
+ "@azure-tools/typespec-azure-core": "~0.40.0",
44
+ "@typespec/compiler": "~0.54.0",
45
+ "@typespec/http": "~0.54.0",
46
+ "@typespec/openapi": "~0.54.0",
47
+ "@typespec/rest": "~0.54.0",
48
+ "@typespec/versioning": "~0.54.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@azure-tools/typespec-autorest": "~0.39.2 || >=0.40.0-dev <0.40.0",
52
- "@azure-tools/typespec-azure-core": "~0.39.1 || >=0.40.0-dev <0.40.0",
53
51
  "@types/node": "~18.11.19",
54
- "@typespec/compiler": "~0.53.1 || >=0.54.0-dev <0.54.0",
55
- "@typespec/eslint-config-typespec": "~0.53.0 || >=0.54.0-dev <0.54.0",
56
- "@typespec/eslint-plugin": "~0.53.0 || >=0.54.0-dev <0.54.0",
57
- "@typespec/http": "~0.53.0 || >=0.54.0-dev <0.54.0",
58
- "@typespec/library-linter": "~0.53.0 || >=0.54.0-dev <0.54.0",
59
- "@typespec/openapi": "~0.53.0 || >=0.54.0-dev <0.54.0",
60
- "@typespec/rest": "~0.53.0 || >=0.54.0-dev <0.54.0",
61
- "@typespec/versioning": "~0.53.0 || >=0.54.0-dev <0.54.0",
62
52
  "@vitest/coverage-v8": "^1.2.2",
63
53
  "@vitest/ui": "^1.2.2",
64
54
  "c8": "^9.1.0",
@@ -66,9 +56,18 @@
66
56
  "rimraf": "~5.0.5",
67
57
  "typescript": "~5.3.3",
68
58
  "vitest": "^1.2.2",
69
- "@typespec/tspd": "~0.46.0"
59
+ "@azure-tools/typespec-autorest": "~0.40.0",
60
+ "@azure-tools/typespec-azure-core": "~0.40.0",
61
+ "@typespec/eslint-config-typespec": "~0.54.0",
62
+ "@typespec/compiler": "~0.54.0",
63
+ "@typespec/eslint-plugin": "~0.54.0",
64
+ "@typespec/http": "~0.54.0",
65
+ "@typespec/library-linter": "~0.54.0",
66
+ "@typespec/openapi": "~0.54.0",
67
+ "@typespec/rest": "~0.54.0",
68
+ "@typespec/tspd": "~0.46.0",
69
+ "@typespec/versioning": "~0.54.0"
70
70
  },
71
- "dependencies": {},
72
71
  "scripts": {
73
72
  "clean": "rimraf ./dist ./temp",
74
73
  "build": "tsc -p . && npm run lint-typespec-library",