@azure-tools/typespec-azure-resource-manager 0.43.0-dev.9 → 0.44.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 (51) hide show
  1. package/README.md +3 -3
  2. package/dist/src/common-types.d.ts +3 -2
  3. package/dist/src/common-types.d.ts.map +1 -1
  4. package/dist/src/common-types.js +48 -6
  5. package/dist/src/common-types.js.map +1 -1
  6. package/dist/src/commontypes.private.decorators.d.ts +44 -0
  7. package/dist/src/commontypes.private.decorators.d.ts.map +1 -0
  8. package/dist/src/commontypes.private.decorators.js +77 -0
  9. package/dist/src/commontypes.private.decorators.js.map +1 -0
  10. package/dist/src/lib.d.ts +17 -2
  11. package/dist/src/lib.d.ts.map +1 -1
  12. package/dist/src/lib.js +6 -0
  13. package/dist/src/lib.js.map +1 -1
  14. package/dist/src/namespace.d.ts.map +1 -1
  15. package/dist/src/namespace.js +35 -0
  16. package/dist/src/namespace.js.map +1 -1
  17. package/dist/src/private.decorators.d.ts +1 -42
  18. package/dist/src/private.decorators.d.ts.map +1 -1
  19. package/dist/src/private.decorators.js +0 -74
  20. package/dist/src/private.decorators.js.map +1 -1
  21. package/dist/src/rules/arm-common-types-version.d.ts.map +1 -1
  22. package/dist/src/rules/arm-common-types-version.js +2 -3
  23. package/dist/src/rules/arm-common-types-version.js.map +1 -1
  24. package/dist/src/rules/core-operations.js +1 -1
  25. package/dist/src/rules/core-operations.js.map +1 -1
  26. package/lib/Legacy/arm.legacy.tsp +1 -0
  27. package/lib/Legacy/managed-identity.tsp +74 -0
  28. package/lib/arm.tsp +3 -7
  29. package/lib/backcompat.tsp +27 -0
  30. package/lib/common-types/common-types.tsp +11 -1
  31. package/lib/common-types/commontypes.private.decorators.tsp +43 -0
  32. package/lib/common-types/customer-managed-keys-ref.tsp +27 -0
  33. package/lib/common-types/customer-managed-keys.tsp +37 -46
  34. package/lib/common-types/extended-location-ref.tsp +1 -0
  35. package/lib/common-types/extended-location.tsp +15 -16
  36. package/lib/common-types/internal.tsp +24 -0
  37. package/lib/common-types/managed-identity-ref.tsp +79 -0
  38. package/lib/common-types/managed-identity.tsp +50 -87
  39. package/lib/common-types/private-links-ref.tsp +159 -0
  40. package/lib/common-types/private-links.tsp +55 -101
  41. package/lib/common-types/types-ref.tsp +414 -0
  42. package/lib/common-types/types.tsp +323 -201
  43. package/lib/decorators.tsp +1 -1
  44. package/lib/{arm.foundations.tsp → foundations/arm.foundations.tsp} +28 -22
  45. package/lib/foundations/backcompat.tsp +39 -0
  46. package/lib/{common-types/backcompat.tsp → foundations/deprecation.tsp} +11 -0
  47. package/lib/models.tsp +18 -3
  48. package/lib/parameters.tsp +14 -67
  49. package/lib/private.decorators.tsp +0 -38
  50. package/lib/responses.tsp +1 -13
  51. package/package.json +14 -14
@@ -180,7 +180,7 @@ extern dec armResourceOperations(target: Interface, _?: unknown);
180
180
  * This decorator is used either on a namespace or a version enum value to indicate
181
181
  * the version of the Azure Resource Manager common-types to use for refs in emitted Swagger files.
182
182
  *
183
- * @param version The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version or an equivalent string value.
183
+ * @param version The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version or an equivalent string value like "v5".
184
184
  */
185
185
  extern dec armCommonTypesVersion(
186
186
  target: Namespace | EnumMember,
@@ -1,30 +1,21 @@
1
+ import "@typespec/openapi";
2
+ import "@typespec/http";
3
+ import "@typespec/rest";
4
+
5
+ import "./backcompat.tsp";
6
+ import "./deprecation.tsp";
7
+ import "../common-types/common-types.tsp";
8
+ import "../decorators.tsp";
9
+ import "../responses.tsp";
10
+ import "../private.decorators.tsp";
11
+ import "../parameters.tsp";
12
+
1
13
  using TypeSpec.Http;
2
14
  using TypeSpec.OpenAPI;
3
- using TypeSpec.Versioning;
4
15
  using Azure.ResourceManager.Private;
5
16
 
6
17
  namespace Azure.ResourceManager.Foundations;
7
18
 
8
- /**
9
- * An internal enum to indicate the resource support for various path types
10
- */
11
- enum ResourceHome {
12
- @doc("The resource is bound to a tenant")
13
- Tenant,
14
-
15
- @doc("The resource is bound to a subscription")
16
- Subscription,
17
-
18
- @doc("The resource is bound to a location")
19
- Location,
20
-
21
- @doc("The resource is bound to a resource group")
22
- ResourceGroup,
23
-
24
- @doc("The resource is bound to an extension")
25
- Extension,
26
- }
27
-
28
19
  /**
29
20
  * Base parameters for a resource.
30
21
  *
@@ -53,6 +44,17 @@ model DefaultBaseParameters<Resource extends {}> {
53
44
  ...ResourceUriParameter;
54
45
  }
55
46
 
47
+ /**
48
+ * Standard type definition for Azure Resource Manager Tags property.
49
+ *
50
+ * It is included in the TrackedResource template definition.
51
+ */
52
+ /** The Azure Resource Manager Resource tags. */
53
+ model ArmTagsProperty {
54
+ /** Resource tags. */
55
+ tags?: Record<string>;
56
+ }
57
+
56
58
  /**
57
59
  * The static parameters for a tenant-based resource
58
60
  */
@@ -113,7 +115,11 @@ model ResourceUpdateModelProperties<
113
115
  model ResourceUpdateModel<
114
116
  Resource extends Foundations.Resource,
115
117
  Properties extends TypeSpec.Reflection.Model
116
- > is OptionalProperties<UpdateableProperties<OmitProperties<Resource, "Name" | "name">>> {
118
+ >
119
+ is OptionalProperties<UpdateableProperties<OmitProperties<
120
+ Resource,
121
+ "Name" | "name" | "properties"
122
+ >>> {
117
123
  @extension("x-ms-client-flatten", true)
118
124
  properties?: ResourceUpdateModelProperties<Resource, Properties>;
119
125
  }
@@ -0,0 +1,39 @@
1
+ namespace Azure.ResourceManager.Foundations {
2
+ // extended-location
3
+ alias ExtendedLocation = CommonTypes.ExtendedLocation;
4
+ alias ExtendedLocationType = CommonTypes.ExtendedLocationType;
5
+
6
+ // managed-identities
7
+ alias ManagedServiceIdentity = CommonTypes.ManagedServiceIdentity;
8
+ #suppress "deprecated" "Need for back compatibility in common-types"
9
+ alias UserAssignedIdentities = CommonTypes.UserAssignedIdentities;
10
+ alias SystemAssignedServiceIdentity = CommonTypes.SystemAssignedServiceIdentity;
11
+ alias UserAssignedIdentity = CommonTypes.UserAssignedIdentity;
12
+ alias ManagedServiceIdentityType = CommonTypes.ManagedServiceIdentityType;
13
+ alias SystemAssignedServiceIdentityType = CommonTypes.SystemAssignedServiceIdentityType;
14
+ alias ManagedSystemIdentityType = SystemAssignedServiceIdentityType;
15
+
16
+ // types
17
+ alias Resource = CommonTypes.Resource;
18
+ alias AzureEntityResource = CommonTypes.AzureEntityResource;
19
+ alias TrackedResource = CommonTypes.TrackedResource;
20
+ alias ProxyResource = CommonTypes.ProxyResource;
21
+ alias ExtensionResource = CommonTypes.ExtensionResource;
22
+ alias Sku = CommonTypes.Sku;
23
+ alias SkuTier = CommonTypes.SkuTier;
24
+ alias OperationListResult = CommonTypes.OperationListResult;
25
+ alias Operation = CommonTypes.Operation;
26
+ alias OperationDisplay = CommonTypes.OperationDisplay;
27
+ alias OperationStatusResult = CommonTypes.OperationStatusResult;
28
+ alias OperationIdParameter = CommonTypes.OperationIdParameter;
29
+ alias ActionType = CommonTypes.ActionType;
30
+ alias Origin = CommonTypes.Origin;
31
+ alias ErrorDetail = CommonTypes.ErrorDetail;
32
+ alias ErrorAdditionalInfo = CommonTypes.ErrorAdditionalInfo;
33
+ alias SystemData = CommonTypes.SystemData;
34
+ alias createdByType = CommonTypes.createdByType;
35
+ alias Plan = CommonTypes.Plan;
36
+ alias CheckNameAvailabilityRequest = CommonTypes.CheckNameAvailabilityRequest;
37
+ alias CheckNameAvailabilityResponse = CommonTypes.CheckNameAvailabilityResponse;
38
+ alias CheckNameAvailabilityReason = CommonTypes.CheckNameAvailabilityReason;
39
+ }
@@ -17,3 +17,14 @@ alias ResourceSkuType = Sku;
17
17
 
18
18
  #deprecated "Please use Foundations.Plan instead of Foundations.ResourcePlanType"
19
19
  alias ResourcePlanType = Plan;
20
+
21
+ // managed-identity
22
+ #deprecated "Please change ManagedIdentityProperties to ManagedServiceIdentity."
23
+ alias ManagedIdentityProperties = ManagedServiceIdentity;
24
+
25
+ #deprecated "Please change ManagedSystemIdentityProperties to SystemAssignedServiceIdentity."
26
+ alias ManagedSystemIdentityProperties = SystemAssignedServiceIdentity;
27
+
28
+ /** Alias of ManagedServiceIdentityType for back compatability. Please change to ManagedServiceIdentityType. */
29
+ #deprecated "Please change to ManagedServiceIdentityType."
30
+ alias ManagedIdentityType = ManagedServiceIdentityType;
package/lib/models.tsp CHANGED
@@ -46,7 +46,6 @@ model ResourceNameParameter<
46
46
  @includeInapplicableMetadataInPayload(false)
47
47
  model TrackedResource<Properties extends {}> extends Foundations.TrackedResource {
48
48
  @doc("The resource-specific properties for this resource.")
49
- @visibility("read", "create")
50
49
  @extension("x-ms-client-flatten", true)
51
50
  properties?: Properties;
52
51
  }
@@ -62,7 +61,6 @@ model TrackedResource<Properties extends {}> extends Foundations.TrackedResource
62
61
  @includeInapplicableMetadataInPayload(false)
63
62
  model ProxyResource<Properties extends {}> extends Foundations.ProxyResource {
64
63
  @doc("The resource-specific properties for this resource.")
65
- @visibility("read", "create")
66
64
  @extension("x-ms-client-flatten", true)
67
65
  properties?: Properties;
68
66
  }
@@ -79,7 +77,6 @@ model ProxyResource<Properties extends {}> extends Foundations.ProxyResource {
79
77
  @includeInapplicableMetadataInPayload(false)
80
78
  model ExtensionResource<Properties extends {}> extends Foundations.ExtensionResource {
81
79
  @doc("The resource-specific properties for this resource.")
82
- @visibility("read", "create")
83
80
  @extension("x-ms-client-flatten", true)
84
81
  properties?: Properties;
85
82
  }
@@ -352,4 +349,22 @@ model ManagedByProperty {
352
349
  managedBy?: string;
353
350
  }
354
351
 
352
+ /** Please use the spread model EncryptionProperty */
353
+ alias Encryption = EncryptionProperty;
354
+ /**
355
+ * Model used only to spread in the `encryption` envelope property for a resource.
356
+ * @example
357
+ *
358
+ * ```typespec
359
+ * model Foo is TrackedResource<FooProperties> {
360
+ * ...Encryption;
361
+ * }
362
+ * ```
363
+ */
364
+ /** All encryption configuration for a resource. */
365
+ model EncryptionProperty {
366
+ /** All encryption configuration for a resource. */
367
+ encryption: EncryptionConfiguration;
368
+ }
369
+
355
370
  //#endregion
@@ -3,80 +3,45 @@ using TypeSpec.Rest;
3
3
  using TypeSpec.OpenAPI;
4
4
  using Azure.ResourceManager.Foundations;
5
5
  using Azure.ResourceManager.Private;
6
+ using Azure.ResourceManager.CommonTypes;
7
+ using Azure.ResourceManager.CommonTypes.Private;
6
8
 
7
9
  namespace Azure.ResourceManager;
8
10
 
9
11
  /**
10
12
  * The default api-version parameter type.
11
13
  */
12
- @doc("The default api-version parameter type.")
13
- model ApiVersionParameter {
14
- @query("api-version")
15
- @minLength(1)
16
- @doc("The API version to use for this operation.")
17
- @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v3)
18
- @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v4)
19
- @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v5)
20
- @resourceParameterBaseFor(
21
- [
22
- ResourceHome.ResourceGroup,
23
- ResourceHome.Subscription,
24
- ResourceHome.Location,
25
- ResourceHome.Tenant,
26
- ResourceHome.Extension
27
- ]
28
- )
29
- apiVersion: string;
30
- }
14
+ alias ApiVersionParameter = CommonTypes.ApiVersionParameter;
31
15
 
32
16
  /**
33
17
  * The default subscriptionId parameter type.
34
18
  */
35
- @doc("The default subscriptionId parameter type.")
36
- model SubscriptionIdParameter {
37
- @path
38
- @minLength(1)
39
- @segment("subscriptions")
40
- @doc("The ID of the target subscription.")
41
- @armCommonParameter("SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v3)
42
- @armCommonParameter("SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v4)
43
- @armCommonParameter("SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v5)
44
- @resourceParameterBaseFor(
45
- [ResourceHome.ResourceGroup, ResourceHome.Subscription, ResourceHome.Location]
46
- )
47
- subscriptionId: string;
48
- }
19
+ alias SubscriptionIdParameter = CommonTypes.SubscriptionIdParameter;
49
20
 
50
21
  /**
51
- * DEPRECATED - DO NOT USE
52
- * The default location parameter type.
22
+ * The default ResourceGroup parameter type.
53
23
  */
54
- @doc("The default location parameter type.")
55
- model LocationParameter {
56
- @path
57
- @minLength(1)
58
- @segment("locations")
59
- @doc("The location name.")
60
- @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v3)
61
- @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v4)
62
- @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v5)
63
- @resourceParameterBaseFor([ResourceHome.Location])
64
- location: string;
65
- }
24
+ alias ResourceGroupParameter = CommonTypes.ResourceGroupNameParameter;
25
+
26
+ /**
27
+ * The default LocationResource parameter type.
28
+ */
29
+ alias LocationResourceParameter = CommonTypes.LocationResourceParameter;
66
30
 
67
31
  /**
32
+ * DEPRECATED - DO NOT USE
68
33
  * The default location parameter type.
69
34
  */
70
35
  @doc("The default location parameter type.")
71
- model LocationResourceParameter {
36
+ model LocationParameter {
72
37
  @path
73
38
  @minLength(1)
74
39
  @segment("locations")
75
40
  @doc("The location name.")
76
- @key
77
41
  @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v3)
78
42
  @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v4)
79
43
  @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v5)
44
+ @resourceParameterBaseFor([ResourceHome.Location])
80
45
  location: string;
81
46
  }
82
47
 
@@ -113,24 +78,6 @@ model ArmLocationResource<BaseType extends
113
78
  ...LocationResourceParameter;
114
79
  }
115
80
 
116
- /**
117
- * The default resource group parameter type.
118
- */
119
- @doc("The default resource group parameter type.")
120
- model ResourceGroupParameter {
121
- @path
122
- @minLength(1)
123
- @maxLength(90)
124
- @segment("resourceGroups")
125
- @pattern("^[-\\w\\._\\(\\)]+$")
126
- @doc("The name of the resource group. The name is case insensitive.")
127
- @armCommonParameter("ResourceGroupNameParameter", Azure.ResourceManager.CommonTypes.Versions.v3)
128
- @armCommonParameter("ResourceGroupNameParameter", Azure.ResourceManager.CommonTypes.Versions.v4)
129
- @armCommonParameter("ResourceGroupNameParameter", Azure.ResourceManager.CommonTypes.Versions.v5)
130
- @resourceParameterBaseFor([ResourceHome.ResourceGroup])
131
- resourceGroupName: string;
132
- }
133
-
134
81
  /**
135
82
  * The default resourceUri parameter type.
136
83
  */
@@ -14,39 +14,6 @@ extern dec armUpdateProviderNamespace(target: Reflection.Operation);
14
14
  */
15
15
  extern dec assignProviderNameValue(target: ModelProperty, resource: Model);
16
16
 
17
- /**
18
- * Describes the shape of model literals accepted by the `version` parameter of
19
- * the `armCommonDefinition` and `armCommonParameter` decorators.
20
- */
21
- alias ArmCommonTypeVersionSpec = {
22
- version: string | EnumMember;
23
- isDefault: boolean;
24
- };
25
-
26
- /**
27
- * @param definitionName Definition name
28
- * @param version Azure Resource Manager Version
29
- * @param referenceFile Reference file
30
- */
31
- extern dec armCommonDefinition(
32
- target: Model,
33
- definitionName?: valueof string,
34
- version?: valueof EnumMember | ArmCommonTypeVersionSpec | string,
35
- referenceFile?: valueof string
36
- );
37
-
38
- /**
39
- * @param definitionName Definition name
40
- * @param version Azure Resource Manager Version
41
- * @param referenceFile Reference file
42
- */
43
- extern dec armCommonParameter(
44
- target: ModelProperty,
45
- definitionName?: valueof string,
46
- version?: valueof EnumMember | ArmCommonTypeVersionSpec | string,
47
- referenceFile?: valueof string
48
- );
49
-
50
17
  /**
51
18
  * This decorator is used to identify Azure Resource Manager resource types and extract their
52
19
  * metadata. It is *not* meant to be used directly by a spec author, it instead
@@ -78,11 +45,6 @@ extern dec resourceBaseParametersOf(target: Model, propertyName: Model);
78
45
  */
79
46
  extern dec resourceParameterBaseFor(target: ModelProperty, values: unknown[]);
80
47
 
81
- /**
82
- * Marks an enum as representing the valid `common-types` versions.
83
- */
84
- extern dec armCommonTypesVersions(target: Enum);
85
-
86
48
  /**
87
49
  * Provides default name decoration on resource name property with
88
50
  * camelcased and pluralized key and segment name
package/lib/responses.tsp CHANGED
@@ -3,6 +3,7 @@ using TypeSpec.Rest;
3
3
  using TypeSpec.OpenAPI;
4
4
  using Azure.ResourceManager.Foundations;
5
5
  using Azure.ResourceManager.Private;
6
+ using Azure.ResourceManager.CommonTypes.Private;
6
7
 
7
8
  namespace Azure.ResourceManager;
8
9
 
@@ -242,19 +243,6 @@ model ArmResourceCreatedSyncResponse<Resource extends Azure.ResourceManager.Foun
242
243
  body: Resource;
243
244
  }
244
245
 
245
- /**
246
- * The standard Azure Resource Manager error response
247
- */
248
- @error
249
- @armCommonDefinition("ErrorResponse", Azure.ResourceManager.CommonTypes.Versions.v3)
250
- @armCommonDefinition("ErrorResponse", Azure.ResourceManager.CommonTypes.Versions.v4)
251
- @armCommonDefinition("ErrorResponse", Azure.ResourceManager.CommonTypes.Versions.v5)
252
- @doc("Common error response for all Azure Resource Manager APIs to return error details for failed operations.")
253
- model ErrorResponse {
254
- @doc("The error object.")
255
- error?: ErrorDetail;
256
- }
257
-
258
246
  /**
259
247
  * @dev Resource exists response
260
248
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-resource-manager",
3
- "version": "0.43.0-dev.9",
3
+ "version": "0.44.0-dev.0",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Resource Manager library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -43,23 +43,23 @@
43
43
  "pluralize": "^8.0.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "@azure-tools/typespec-azure-core": "~0.42.0 || >=0.43.0-dev <0.43.0",
47
- "@typespec/compiler": "~0.56.0 || >=0.57.0-dev <0.57.0",
48
- "@typespec/http": "~0.56.0 || >=0.57.0-dev <0.57.0",
49
- "@typespec/openapi": "~0.56.0 || >=0.57.0-dev <0.57.0",
50
- "@typespec/rest": "~0.56.0 || >=0.57.0-dev <0.57.0",
51
- "@typespec/versioning": "~0.56.0 || >=0.57.0-dev <0.57.0"
46
+ "@azure-tools/typespec-azure-core": "~0.43.0 || >=0.44.0-dev <0.44.0",
47
+ "@typespec/compiler": "~0.57.0 || >=0.58.0-dev <0.58.0",
48
+ "@typespec/http": "~0.57.0 || >=0.58.0-dev <0.58.0",
49
+ "@typespec/openapi": "~0.57.0 || >=0.58.0-dev <0.58.0",
50
+ "@typespec/rest": "~0.57.0 || >=0.58.0-dev <0.58.0",
51
+ "@typespec/versioning": "~0.57.0 || >=0.58.0-dev <0.58.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@azure-tools/typespec-azure-core": "~0.42.0 || >=0.43.0-dev <0.43.0",
54
+ "@azure-tools/typespec-azure-core": "~0.43.0 || >=0.44.0-dev <0.44.0",
55
55
  "@types/node": "~18.11.19",
56
56
  "@types/pluralize": "^0.0.33",
57
- "@typespec/compiler": "~0.56.0 || >=0.57.0-dev <0.57.0",
58
- "@typespec/http": "~0.56.0 || >=0.57.0-dev <0.57.0",
59
- "@typespec/library-linter": "~0.56.0 || >=0.57.0-dev <0.57.0",
60
- "@typespec/openapi": "~0.56.0 || >=0.57.0-dev <0.57.0",
61
- "@typespec/rest": "~0.56.0 || >=0.57.0-dev <0.57.0",
62
- "@typespec/versioning": "~0.56.0 || >=0.57.0-dev <0.57.0",
57
+ "@typespec/compiler": "~0.57.0 || >=0.58.0-dev <0.58.0",
58
+ "@typespec/http": "~0.57.0 || >=0.58.0-dev <0.58.0",
59
+ "@typespec/library-linter": "~0.57.0 || >=0.58.0-dev <0.58.0",
60
+ "@typespec/openapi": "~0.57.0 || >=0.58.0-dev <0.58.0",
61
+ "@typespec/rest": "~0.57.0 || >=0.58.0-dev <0.58.0",
62
+ "@typespec/versioning": "~0.57.0 || >=0.58.0-dev <0.58.0",
63
63
  "@vitest/coverage-v8": "^1.6.0",
64
64
  "@vitest/ui": "^1.6.0",
65
65
  "c8": "^9.1.0",