@azure-tools/typespec-azure-resource-manager 0.71.0-dev.9 → 0.72.0-dev.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 (102) hide show
  1. package/README.md +4 -2
  2. package/dist/generated-defs/Azure.ResourceManager.BaseTypes.d.ts +1 -1
  3. package/dist/src/base-types.d.ts +1 -1
  4. package/dist/src/base-types.d.ts.map +1 -1
  5. package/dist/src/common-types.d.ts +4 -4
  6. package/dist/src/common-types.d.ts.map +1 -1
  7. package/dist/src/commontypes.private.decorators.d.ts +2 -2
  8. package/dist/src/commontypes.private.decorators.d.ts.map +1 -1
  9. package/dist/src/linter.d.ts.map +1 -1
  10. package/dist/src/linter.js +6 -2
  11. package/dist/src/linter.js.map +1 -1
  12. package/dist/src/namespace.d.ts +2 -2
  13. package/dist/src/namespace.d.ts.map +1 -1
  14. package/dist/src/operations.d.ts +4 -4
  15. package/dist/src/operations.d.ts.map +1 -1
  16. package/dist/src/operations.js.map +1 -1
  17. package/dist/src/private.decorators.d.ts +2 -2
  18. package/dist/src/private.decorators.d.ts.map +1 -1
  19. package/dist/src/resource.d.ts +4 -4
  20. package/dist/src/resource.d.ts.map +1 -1
  21. package/dist/src/rules/arm-agent-base-type-child-resources.js.map +1 -1
  22. package/dist/src/rules/arm-agent-base-type-lifecycle-operations.js.map +1 -1
  23. package/dist/src/rules/arm-common-types-version.js.map +1 -1
  24. package/dist/src/rules/arm-custom-resource-no-key.js.map +1 -1
  25. package/dist/src/rules/arm-custom-resource-usage-discourage.d.ts.map +1 -1
  26. package/dist/src/rules/arm-custom-resource-usage-discourage.js +1 -1
  27. package/dist/src/rules/arm-custom-resource-usage-discourage.js.map +1 -1
  28. package/dist/src/rules/arm-delete-response-codes.js.map +1 -1
  29. package/dist/src/rules/arm-feature-file-usage-discourage.js.map +1 -1
  30. package/dist/src/rules/arm-legacy-operations-discourage.js.map +1 -1
  31. package/dist/src/rules/arm-post-response-codes.js.map +1 -1
  32. package/dist/src/rules/arm-put-response-codes.js.map +1 -1
  33. package/dist/src/rules/arm-resource-action-no-segment.js.map +1 -1
  34. package/dist/src/rules/arm-resource-interfaces.js.map +1 -1
  35. package/dist/src/rules/arm-resource-invalid-action-verb.js.map +1 -1
  36. package/dist/src/rules/arm-resource-invalid-envelope-property.d.ts.map +1 -1
  37. package/dist/src/rules/arm-resource-invalid-envelope-property.js +1 -1
  38. package/dist/src/rules/arm-resource-invalid-envelope-property.js.map +1 -1
  39. package/dist/src/rules/arm-resource-invalid-version-format.js.map +1 -1
  40. package/dist/src/rules/arm-resource-operation-response.js.map +1 -1
  41. package/dist/src/rules/arm-resource-path-invalid-chars.d.ts.map +1 -1
  42. package/dist/src/rules/arm-resource-path-invalid-chars.js +1 -1
  43. package/dist/src/rules/arm-resource-path-invalid-chars.js.map +1 -1
  44. package/dist/src/rules/arm-resource-provisioning-state-rule.d.ts.map +1 -1
  45. package/dist/src/rules/arm-resource-provisioning-state-rule.js +1 -1
  46. package/dist/src/rules/arm-resource-provisioning-state-rule.js.map +1 -1
  47. package/dist/src/rules/beyond-nesting-levels.js.map +1 -1
  48. package/dist/src/rules/envelope-properties.js.map +1 -1
  49. package/dist/src/rules/improper-subscription-list-operation.js.map +1 -1
  50. package/dist/src/rules/lro-location-header.js.map +1 -1
  51. package/dist/src/rules/no-empty-model.js.map +1 -1
  52. package/dist/src/rules/no-reserved-resource-property.js.map +1 -1
  53. package/dist/src/rules/no-resource-delete-operation.js.map +1 -1
  54. package/dist/src/rules/no-response-body.d.ts.map +1 -1
  55. package/dist/src/rules/no-response-body.js +1 -1
  56. package/dist/src/rules/no-response-body.js.map +1 -1
  57. package/dist/src/rules/patch-envelope-properties.d.ts.map +1 -1
  58. package/dist/src/rules/patch-envelope-properties.js +1 -1
  59. package/dist/src/rules/patch-envelope-properties.js.map +1 -1
  60. package/dist/src/rules/retry-after.js.map +1 -1
  61. package/dist/src/rules/use-api-version.d.ts +4 -0
  62. package/dist/src/rules/use-api-version.d.ts.map +1 -0
  63. package/dist/src/rules/use-api-version.js +45 -0
  64. package/dist/src/rules/use-api-version.js.map +1 -0
  65. package/dist/src/rules/use-interface.d.ts +4 -0
  66. package/dist/src/rules/use-interface.d.ts.map +1 -0
  67. package/dist/src/rules/use-interface.js +29 -0
  68. package/dist/src/rules/use-interface.js.map +1 -0
  69. package/dist/src/rules/use-operation-decorator.d.ts +5 -0
  70. package/dist/src/rules/use-operation-decorator.d.ts.map +1 -0
  71. package/dist/src/rules/use-operation-decorator.js +133 -0
  72. package/dist/src/rules/use-operation-decorator.js.map +1 -0
  73. package/dist/src/rules/use-relationship-required-properties.d.ts.map +1 -1
  74. package/dist/src/rules/use-relationship-required-properties.js +1 -1
  75. package/dist/src/rules/use-relationship-required-properties.js.map +1 -1
  76. package/dist/src/rules/utils.d.ts +2 -2
  77. package/dist/src/rules/utils.d.ts.map +1 -1
  78. package/dist/src/rules/utils.js.map +1 -1
  79. package/dist/src/rules/version-progression.d.ts.map +1 -1
  80. package/dist/src/rules/version-progression.js +1 -1
  81. package/dist/src/rules/version-progression.js.map +1 -1
  82. package/dist/src/testing/index.d.ts +1 -1
  83. package/dist/src/testing/index.d.ts.map +1 -1
  84. package/lib/base-types/agent.tsp +3 -10
  85. package/lib/base-types/base-types.tsp +1 -1
  86. package/lib/common-types/billing-data.tsp +211 -0
  87. package/lib/common-types/common-types.tsp +1 -1
  88. package/lib/common-types/managed-identity-with-delegation.tsp +1 -0
  89. package/lib/common-types/network-security-perimeter.tsp +29 -0
  90. package/lib/common-types/types.tsp +5 -0
  91. package/lib/extension/parameters.tsp +2 -0
  92. package/lib/foundations/arm.foundations.tsp +1 -0
  93. package/lib/interfaces.tsp +2 -24
  94. package/lib/legacy-types/resource.tsp +1 -0
  95. package/lib/models.tsp +19 -1
  96. package/lib/private-endpoints.tsp +0 -2
  97. package/lib/private-links.tsp +0 -5
  98. package/package.json +15 -15
  99. package/dist/src/rules/core-operations.d.ts +0 -6
  100. package/dist/src/rules/core-operations.d.ts.map +0 -1
  101. package/dist/src/rules/core-operations.js +0 -105
  102. package/dist/src/rules/core-operations.js.map +0 -1
@@ -1,105 +0,0 @@
1
- import { createRule, fileRef, isTemplateInstance, paramMessage, } from "@typespec/compiler";
2
- import { SyntaxKind } from "@typespec/compiler/ast";
3
- import { getOperationVerb } from "@typespec/http";
4
- import { getSegment } from "@typespec/rest";
5
- import { getNamespaceName, getSourceModel, isSourceOperationResourceManagerInternal, isTemplatedInterfaceOperation, } from "./utils.js";
6
- export const coreOperationsRule = createRule({
7
- name: "arm-resource-operation",
8
- docs: fileRef.fromPackageRoot("src/rules/arm-resource-operation.md"),
9
- severity: "warning",
10
- description: "Validate ARM Resource operations.",
11
- url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-resource-operation",
12
- messages: {
13
- default: "All Resource operations must use an api-version parameter. Please include Azure.ResourceManager.ApiVersionParameter in the operation parameter list using the spread (...ApiVersionParameter) operator, or using one of the common resource parameter models.",
14
- opOutsideInterface: "All operations must be inside an interface declaration.",
15
- opMissingDecorator: paramMessage `Resource ${"verb"} operation must be decorated with ${"decorator"}.`,
16
- },
17
- create(context) {
18
- return {
19
- operation: (operation) => {
20
- if (!isSourceOperationResourceManagerInternal(operation) &&
21
- !isTemplateInstance(operation)) {
22
- const verb = getOperationVerb(context.program, operation);
23
- if (!isTemplatedInterfaceOperation(operation) &&
24
- (!operation.node?.parent ||
25
- operation.node.parent.kind !== SyntaxKind.InterfaceStatement)) {
26
- context.reportDiagnostic({
27
- messageId: "opOutsideInterface",
28
- target: operation,
29
- });
30
- }
31
- const parameters = operation.parameters;
32
- if (parameters === undefined ||
33
- parameters === null ||
34
- !hasApiParameter(context.program, parameters)) {
35
- context.reportDiagnostic({
36
- target: operation,
37
- });
38
- }
39
- if (verb) {
40
- const requiredDecorators = resourceOperationDecorators[verb];
41
- if (requiredDecorators?.length > 0) {
42
- const decorator = operation.decorators.find((d) => requiredDecorators.indexOf(d.decorator.name) >= 0);
43
- if (!decorator && !isArmProviderOperation(context.program, operation)) {
44
- context.reportDiagnostic({
45
- messageId: "opMissingDecorator",
46
- target: operation,
47
- format: {
48
- verb: verb.toUpperCase(),
49
- decorator: requiredDecorators.map((d) => `@${d.substring(1)}`).join(" or "),
50
- },
51
- });
52
- }
53
- }
54
- }
55
- }
56
- },
57
- };
58
- },
59
- });
60
- const resourceOperationDecorators = {
61
- put: ["$armResourceCreateOrUpdate"],
62
- get: ["$armResourceRead", "$armResourceList"],
63
- patch: ["$armResourceUpdate"],
64
- delete: ["$armResourceDelete"],
65
- post: ["$armResourceAction", "$armResourceCollectionAction"],
66
- head: [],
67
- };
68
- function isApiParameter(program, property) {
69
- if (property.type.kind !== "Scalar")
70
- return false;
71
- if (!property.sourceProperty)
72
- return false;
73
- const sourceModel = getSourceModel(property.sourceProperty);
74
- if (sourceModel === undefined)
75
- return false;
76
- return (sourceModel.name === "ApiVersionParameter" &&
77
- getNamespaceName(program, sourceModel) === "Azure.ResourceManager.CommonTypes");
78
- }
79
- function hasApiParameter(program, model) {
80
- if (model.properties === undefined || model.properties.size === 0)
81
- return false;
82
- const apiVersionParams = [...model.properties.values()].filter((i) => isApiParameter(program, i));
83
- return apiVersionParams !== null && apiVersionParams.length === 1;
84
- }
85
- function isStaticSegment(segment, property) {
86
- return segment === undefined || segment === "locations";
87
- }
88
- function isArmProviderOperation(program, operation) {
89
- let isProviderAction = false;
90
- for (const [index, [, property]] of [...operation.parameters.properties].entries()) {
91
- const segment = getSegment(program, property);
92
- if (segment === "providers") {
93
- isProviderAction = true;
94
- }
95
- else if (isProviderAction && !isStaticSegment(segment, property)) {
96
- return false;
97
- }
98
- const isLastSegment = index === operation.parameters.properties.size - 1;
99
- if (isLastSegment && !segment) {
100
- return true;
101
- }
102
- }
103
- return false;
104
- }
105
- //# sourceMappingURL=core-operations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-operations.js","sourceRoot":"","sources":["../../../src/rules/core-operations.ts"],"names":[],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