From 62eef4062edb4c491c07f652a51330b7ac98e93a Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Wed, 29 May 2024 23:53:14 -0700 Subject: [PATCH 01/25] ARM ReOrg Compiles with no error --- .../lib/arm.tsp | 9 +- .../lib/backcompat.tsp | 21 ++ .../lib/common-types/common-types.tsp | 10 +- .../commontypes.private.decorators.tsp | 43 +++ .../customer-managed-keys-ref.tsp | 14 + .../common-types/customer-managed-keys.tsp | 50 ++-- .../common-types/extended-location-ref.tsp | 1 + .../lib/common-types/extended-location.tsp | 5 +- .../lib/common-types/managed-identity-ref.tsp | 67 +++++ .../lib/common-types/managed-identity.tsp | 52 +--- .../lib/common-types/private-links-ref.tsp | 64 +++++ .../lib/common-types/private-links.tsp | 100 +------ .../lib/common-types/types-ref.tsp | 129 +++++++++ .../lib/common-types/types.tsp | 263 ++++++++---------- .../lib/decorators.tsp | 7 +- .../lib/{ => foundations}/arm.foundations.tsp | 13 +- .../lib/foundations/backcompat.tsp | 42 +++ .../deprecation.tsp} | 11 + .../lib/models.tsp | 34 +++ .../lib/parameters.tsp | 2 + .../lib/private.decorators.tsp | 38 --- .../lib/responses.tsp | 1 + .../scripts/common-types.tsp | 29 ++ .../scripts/generate-common-types.js | 23 ++ .../src/common-types.ts | 14 +- .../src/commontypes.private.decorators.ts | 135 +++++++++ .../src/private.decorators.ts | 122 -------- .../arm-common-types-registration.test.ts | 2 +- 28 files changed, 802 insertions(+), 499 deletions(-) create mode 100644 packages/typespec-azure-resource-manager/lib/backcompat.tsp create mode 100644 packages/typespec-azure-resource-manager/lib/common-types/commontypes.private.decorators.tsp create mode 100644 packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp create mode 100644 packages/typespec-azure-resource-manager/lib/common-types/extended-location-ref.tsp create mode 100644 packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp create mode 100644 packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp create mode 100644 packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp rename packages/typespec-azure-resource-manager/lib/{ => foundations}/arm.foundations.tsp (96%) create mode 100644 packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp rename packages/typespec-azure-resource-manager/lib/{common-types/backcompat.tsp => foundations/deprecation.tsp} (59%) create mode 100644 packages/typespec-azure-resource-manager/scripts/common-types.tsp create mode 100644 packages/typespec-azure-resource-manager/scripts/generate-common-types.js create mode 100644 packages/typespec-azure-resource-manager/src/commontypes.private.decorators.ts diff --git a/packages/typespec-azure-resource-manager/lib/arm.tsp b/packages/typespec-azure-resource-manager/lib/arm.tsp index dec73193f1..0a471f32bc 100644 --- a/packages/typespec-azure-resource-manager/lib/arm.tsp +++ b/packages/typespec-azure-resource-manager/lib/arm.tsp @@ -5,14 +5,9 @@ import "@typespec/rest"; import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; -import "./arm.foundations.tsp"; +import "./foundations/arm.foundations.tsp"; import "./common-types/common-types.tsp"; -import "./common-types/backcompat.tsp"; -import "./common-types/types.tsp"; -import "./common-types/managed-identity.tsp"; -import "./common-types/private-links.tsp"; -import "./common-types/customer-managed-keys.tsp"; -import "./common-types/extended-location.tsp"; +import "./backcompat.tsp"; import "./private.decorators.tsp"; import "./models.tsp"; import "./operations.tsp"; diff --git a/packages/typespec-azure-resource-manager/lib/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/backcompat.tsp new file mode 100644 index 0000000000..720481de46 --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/backcompat.tsp @@ -0,0 +1,21 @@ +using Azure.ResourceManager.CommonTypes; + +namespace Azure.ResourceManager { + // customer-managed-keys + alias InfrastructureEncryption = CommonTypes.InfrastructureEncryption; + alias KeyEncryptionIdentity = CommonTypes.KeyEncryptionKeyIdentity; + alias KeyEncryptionKeyIdentity = CommonTypes.KeyEncryptionKeyIdentity; + alias CustomerManagedKeyEncryption = CommonTypes.CustomerManagedKeyEncryption; + alias EncryptionConfiguration = CommonTypes.EncryptionConfiguration; + alias Encryption = CommonTypes.Encryption; + + // private-links + alias PrivateEndpoint = CommonTypes.PrivateEndpoint; + alias PrivateEndpointConnection = CommonTypes.PrivateEndpointConnection; + alias PrivateEndpointConnectionProperties = CommonTypes.PrivateEndpointConnectionProperties; + alias PrivateLinkServiceConnectionState = CommonTypes.PrivateLinkServiceConnectionState; + alias PrivateEndpointConnectionProvisioningState = CommonTypes.PrivateEndpointConnectionProvisioningState; + alias PrivateEndpointServiceConnectionStatus = CommonTypes.PrivateEndpointServiceConnectionStatus; + alias PrivateEndpointConnectionParameter = CommonTypes.PrivateEndpointConnectionParameter; + alias PrivateLinkResourceParameter = CommonTypes.PrivateLinkResourceParameter; +} diff --git a/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp index 187403ac1a..2cf7e027fa 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp @@ -1,10 +1,18 @@ import "@typespec/versioning"; +import "./common-types.tsp"; +import "./types-ref.tsp"; +import "./managed-identity-ref.tsp"; +import "./private-links-ref.tsp"; +import "./customer-managed-keys-ref.tsp"; +import "./extended-location-ref.tsp"; +import "./commontypes.private.decorators.tsp"; using TypeSpec.Versioning; +@versioned(Versions) namespace Azure.ResourceManager.CommonTypes; -@Private.armCommonTypesVersions +@CommonTypes.Private.armCommonTypesVersions @doc("The Azure Resource Manager common-types versions.") enum Versions { @doc("The Azure Resource Manager v3 common types.") diff --git a/packages/typespec-azure-resource-manager/lib/common-types/commontypes.private.decorators.tsp b/packages/typespec-azure-resource-manager/lib/common-types/commontypes.private.decorators.tsp new file mode 100644 index 0000000000..889a7ec8e1 --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/common-types/commontypes.private.decorators.tsp @@ -0,0 +1,43 @@ +import "../../dist/src/commontypes.private.decorators.js"; + +namespace Azure.ResourceManager.CommonTypes.Private; + +using TypeSpec.Reflection; + +/** + * Describes the shape of model literals accepted by the `version` parameter of + * the `armCommonDefinition` and `armCommonParameter` decorators. + */ +alias ArmCommonTypeVersionSpec = { + version: string | EnumMember; + isDefault: boolean; +}; + +/** + * @param definitionName Definition name + * @param version Azure Resource Manager Version + * @param referenceFile Reference file + */ +extern dec armCommonDefinition( + target: Model, + definitionName?: valueof string, + version?: valueof EnumMember | ArmCommonTypeVersionSpec | string, + referenceFile?: valueof string +); + +/** + * @param definitionName Definition name + * @param version Azure Resource Manager Version + * @param referenceFile Reference file + */ +extern dec armCommonParameter( + target: ModelProperty, + definitionName?: valueof string, + version?: valueof EnumMember | ArmCommonTypeVersionSpec | string, + referenceFile?: valueof string +); + +/** + * Marks an enum as representing the valid `common-types` versions. + */ +extern dec armCommonTypesVersions(target: Enum); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp new file mode 100644 index 0000000000..6766f97136 --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp @@ -0,0 +1,14 @@ +import "./customer-managed-keys.tsp"; + +namespace Azure.ResourceManager.CommonTypes.Private; + +@@armCommonDefinition(EncryptionConfiguration, + "encryption", + Azure.ResourceManager.CommonTypes.Versions.v4, + "customermanagedkeys.json" +); +@@armCommonDefinition(EncryptionConfiguration, + "encryption", + Azure.ResourceManager.CommonTypes.Versions.v5, + "customermanagedkeys.json" +); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp index eefe408a05..1bcca19489 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp @@ -1,14 +1,15 @@ using Azure.Core; -using Azure.ResourceManager.Private; +using TypeSpec.Versioning; -namespace Azure.ResourceManager; +namespace Azure.ResourceManager.CommonTypes; -@doc("(Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled.") +/** (Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled. */ +@added(CommonTypes.Versions.v4) union InfrastructureEncryption { - @doc("Encryption is enabled") + /** Encryption is enabled */ Enabled: "enabled", - @doc("Encryption is disabled") + /** Encryption is disabled */ Disabled: "disabled", string, @@ -17,53 +18,51 @@ union InfrastructureEncryption { /** Alias of keyEncryptionKeyIdentity for back compatibility. Please change to keyEncryptionKeyIdentity. */ alias KeyEncryptionIdentity = KeyEncryptionKeyIdentity; -@doc("The type of identity to use.") +/** The type of identity to use. */ +@added(CommonTypes.Versions.v4) union KeyEncryptionKeyIdentity { - @doc("System assigned identity") + /** System assigned identity */ SystemAssignedIdentity: "systemAssignedIdentity", - @doc("User assigned identity") + /** User assigned identity */ UserAssignedIdentity: "userAssignedIdentity", - @doc("Delegated identity") + /** Delegated identity */ DelegatedResourceIdentity: "delegatedResourceIdentity", string, } -@doc("Customer-managed key encryption properties for the resource.") +/** Customer-managed key encryption properties for the resource. */ +@added(CommonTypes.Versions.v4) model CustomerManagedKeyEncryption { - @doc("The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity.") + /** The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. */ keyEncryptionKeyIdentity?: KeyEncryptionKeyIdentity; - @doc("User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity.") + /** User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. */ userAssignedIdentityResourceId?: Azure.Core.armResourceIdentifier<[ { type: "Microsoft.ManagedIdentity/userAssignedIdentities"; } ]>; - @doc("application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540") + /** application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540 */ federatedClientId?: uuid; - @doc("delegated identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity and userAssignedIdentity - internal use only.") + /** delegated identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity and userAssignedIdentity - internal use only. */ delegatedIdentityClientId?: uuid; } -@doc("All encryption configuration for a resource.") -@armCommonDefinition( - "encryption", - Azure.ResourceManager.CommonTypes.Versions.v5, - "customermanagedkeys.json" -) +/** All encryption configuration for a resource. */ +@added(CommonTypes.Versions.v4) model EncryptionConfiguration { - @doc("Indicates if infrastructure encryption is enabled or disabled.") + /** Indicates if infrastructure encryption is enabled or disabled. */ infrastructureEncryption?: InfrastructureEncryption; - @doc("All customer-managed key encryption properties for the resource.") + /** All customer-managed key encryption properties for the resource. */ customerManagedKeyEncryption?: CustomerManagedKeyEncryption; - @doc("key encryption key Url, versioned or unversioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek.") + /** key encryption key Url, versioned or unversioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. */ keyEncryptionKeyUrl?: string; } @@ -77,8 +76,9 @@ model EncryptionConfiguration { * } * ``` */ -@doc("All encryption configuration for a resource.") +/** All encryption configuration for a resource. */ +@added(CommonTypes.Versions.v4) model Encryption { - @doc("All encryption configuration for a resource.") + /** All encryption configuration for a resource. */ encryption: EncryptionConfiguration; } diff --git a/packages/typespec-azure-resource-manager/lib/common-types/extended-location-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/extended-location-ref.tsp new file mode 100644 index 0000000000..5feca7a65a --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/common-types/extended-location-ref.tsp @@ -0,0 +1 @@ +import "./extended-location.tsp"; diff --git a/packages/typespec-azure-resource-manager/lib/common-types/extended-location.tsp b/packages/typespec-azure-resource-manager/lib/common-types/extended-location.tsp index c9a7a398d8..37ddd438e4 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/extended-location.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/extended-location.tsp @@ -1,4 +1,5 @@ -namespace Azure.ResourceManager.Foundations { + +namespace Azure.ResourceManager.CommonTypes; /** The complex type of the extended location. */ model ExtendedLocation { /** The name of the extended location. */ @@ -18,4 +19,4 @@ namespace Azure.ResourceManager.Foundations { string, } -} + diff --git a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp new file mode 100644 index 0000000000..51933e44b7 --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp @@ -0,0 +1,67 @@ +import "./managed-identity.tsp"; + +using Azure.ResourceManager.CommonTypes.Private; + +namespace Azure.ResourceManager.CommonTypes; + +/** + * The properties of the managed service identities assigned to this resource. + */ +@@armCommonDefinition( + ManagedServiceIdentity, + "ManagedServiceIdentity", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "managedidentity.json" +); +@@armCommonDefinition( + ManagedServiceIdentity, + "ManagedServiceIdentity", + Azure.ResourceManager.CommonTypes.Versions.v5, + "managedidentity.json" +); + +/** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", */ +@@armCommonDefinition( + UserAssignedIdentities, + "UserAssignedIdentities", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "managedidentity.json" +); +@@armCommonDefinition( + UserAssignedIdentities, + "UserAssignedIdentities", + Azure.ResourceManager.CommonTypes.Versions.v5, + "managedidentity.json" +); + +/** + * The properties of the service-assigned identity associated with this resource. + */ +@@armCommonDefinition( + SystemAssignedServiceIdentity, + "SystemAssignedServiceIdentity", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "managedidentity.json" +); +@@armCommonDefinition( + SystemAssignedServiceIdentity, + "SystemAssignedServiceIdentity", + Azure.ResourceManager.CommonTypes.Versions.v5, + "managedidentity.json" +); + +/** + * A managed identity assigned by the user. + */ +@@armCommonDefinition( + UserAssignedIdentity, + "UserAssignedIdentity", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "managedidentity.json" +); +@@armCommonDefinition( + UserAssignedIdentity, + "UserAssignedIdentity", + Azure.ResourceManager.CommonTypes.Versions.v5, + "managedidentity.json" +); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp index f44b698300..f0384e42d5 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp @@ -1,22 +1,10 @@ using Azure.ResourceManager.Private; -namespace Azure.ResourceManager.Foundations; +namespace Azure.ResourceManager.CommonTypes; -#deprecated "Please change ManagedIdentityProperties to ManagedServiceIdentity." -alias ManagedIdentityProperties = ManagedServiceIdentity; /** * The properties of the managed service identities assigned to this resource. */ -@armCommonDefinition( - "ManagedServiceIdentity", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "managedidentity.json" -) -@armCommonDefinition( - "ManagedServiceIdentity", - Azure.ResourceManager.CommonTypes.Versions.v5, - "managedidentity.json" -) model ManagedServiceIdentity { @doc("The Active Directory tenant id of the principal.") @visibility("read") @@ -35,33 +23,11 @@ model ManagedServiceIdentity { /** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", */ #deprecated "Do not use this model. Instead, use Record directly. Using this model will result in a different client SDK when generated from TypeSpec compared to the Swagger." -@armCommonDefinition( - "UserAssignedIdentities", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "managedidentity.json" -) -@armCommonDefinition( - "UserAssignedIdentities", - Azure.ResourceManager.CommonTypes.Versions.v5, - "managedidentity.json" -) model UserAssignedIdentities is Record; -#deprecated "Please change ManagedSystemIdentityProperties to SystemAssignedServiceIdentity." -alias ManagedSystemIdentityProperties = SystemAssignedServiceIdentity; /** * The properties of the service-assigned identity associated with this resource. */ -@armCommonDefinition( - "SystemAssignedServiceIdentity", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "managedidentity.json" -) -@armCommonDefinition( - "SystemAssignedServiceIdentity", - Azure.ResourceManager.CommonTypes.Versions.v5, - "managedidentity.json" -) model SystemAssignedServiceIdentity { @doc("The Active Directory tenant id of the principal.") @visibility("read") @@ -75,22 +41,9 @@ model SystemAssignedServiceIdentity { type: SystemAssignedServiceIdentityType; } -/** Alias of ManagedServiceIdentityType for back compatability. Please change to ManagedServiceIdentityType. */ -#deprecated "Please change to ManagedServiceIdentityType." -alias ManagedIdentityType = ManagedServiceIdentityType; /** * A managed identity assigned by the user. */ -@armCommonDefinition( - "UserAssignedIdentity", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "managedidentity.json" -) -@armCommonDefinition( - "UserAssignedIdentity", - Azure.ResourceManager.CommonTypes.Versions.v5, - "managedidentity.json" -) @doc("A managed identity assigned by the user.") model UserAssignedIdentity { @doc("The active directory client identifier for this principal.") @@ -120,9 +73,6 @@ union ManagedServiceIdentityType { string, } -/** Alias of SystemAssignedServiceIdentityType for back compatability. Please change to SystemAssignedServiceIdentityType. */ -alias ManagedSystemIdentityType = SystemAssignedServiceIdentityType; - /** * The kind of managemed identity assigned to this resource. */ diff --git a/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp new file mode 100644 index 0000000000..dca2081e36 --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp @@ -0,0 +1,64 @@ +import "./private-links.tsp"; + +using Azure.ResourceManager.CommonTypes.Private; + +namespace Azure.ResourceManager.CommonTypes; + +/** The private endpoint resource */ +@@armCommonDefinition( + PrivateEndpoint, + "PrivateEndpoint", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition( + PrivateEndpoint, + "PrivateEndpoint", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); + + +/** Properties of he private endpoint connection resource */ +@@armCommonDefinition( + PrivateEndpointConnectionProperties, + "PrivateEndpointConnectionProperties", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition( + PrivateEndpointConnectionProperties, + "PrivateEndpointConnectionProperties", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); + +/** A collection of information about the state of the connection between service consumer and provider. */ +@@armCommonDefinition( + PrivateLinkServiceConnectionState, + "PrivateLinkServiceConnectionState", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition( + PrivateLinkServiceConnectionState, + "PrivateLinkServiceConnectionState", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); + +/** Properties of a private link resource. */ +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Matches current common code" +@@armCommonDefinition( + PrivateLinkResourceProperties, + "PrivateLinkResourceProperties", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition( + PrivateLinkResourceProperties, + "PrivateLinkResourceProperties", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); + diff --git a/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp b/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp index 1936211379..ac2d022505 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp @@ -1,27 +1,10 @@ -import "@typespec/openapi"; -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; - using TypeSpec.Http; -using TypeSpec.OpenAPI; using TypeSpec.Versioning; -using Azure.ResourceManager.Private; -namespace Azure.ResourceManager; +namespace Azure.ResourceManager.CommonTypes; /** The private endpoint resource */ -@armCommonDefinition( - "PrivateEndpoint", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "privatelinks.json" -) -@armCommonDefinition( - "PrivateEndpoint", - Azure.ResourceManager.CommonTypes.Versions.v5, - "privatelinks.json" -) +@added(CommonTypes.Versions.v4) model PrivateEndpoint { /** The resource identifier for private endpoint */ id?: Azure.Core.armResourceIdentifier<[ @@ -32,22 +15,14 @@ model PrivateEndpoint { } /** The private endpoint connection resource */ +@added(CommonTypes.Versions.v4) model PrivateEndpointConnection extends Azure.ResourceManager.Foundations.ProxyResource { /** The private endpoint connection properties */ properties?: PrivateEndpointConnectionProperties; } /** Properties of he private endpoint connection resource */ -@armCommonDefinition( - "PrivateEndpointConnectionProperties", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "privatelinks.json" -) -@armCommonDefinition( - "PrivateEndpointConnectionProperties", - Azure.ResourceManager.CommonTypes.Versions.v5, - "privatelinks.json" -) +@added(CommonTypes.Versions.v4) model PrivateEndpointConnectionProperties { /** The group identifiers for the private endpoint resource */ @visibility("read") @@ -64,16 +39,7 @@ model PrivateEndpointConnectionProperties { } /** A collection of information about the state of the connection between service consumer and provider. */ -@armCommonDefinition( - "PrivateLinkServiceConnectionState", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "privatelinks.json" -) -@armCommonDefinition( - "PrivateLinkServiceConnectionState", - Azure.ResourceManager.CommonTypes.Versions.v5, - "privatelinks.json" -) +@added(CommonTypes.Versions.v4) model PrivateLinkServiceConnectionState { /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ status?: PrivateEndpointServiceConnectionStatus; @@ -86,6 +52,7 @@ model PrivateLinkServiceConnectionState { } /** The provisioning state of the connection */ +@added(CommonTypes.Versions.v4) union PrivateEndpointConnectionProvisioningState { ResourceProvisioningState, @@ -97,6 +64,7 @@ union PrivateEndpointConnectionProvisioningState { } /** The private endpoint connection status */ +@added(CommonTypes.Versions.v4) union PrivateEndpointServiceConnectionStatus { /** Connectionaiting for approval or rejection */ Pending: "Pending", @@ -110,65 +78,14 @@ union PrivateEndpointServiceConnectionStatus { string, } -model PrivateLinkResource extends Azure.ResourceManager.Foundations.ProxyResource { - /** Properties of the private link resource. */ - properties?: PrivateLinkResourceProperties; -} - -/** Properties of a private link resource. */ -#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Matches current common code" -@armCommonDefinition( - "PrivateLinkResourceProperties", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "privatelinks.json" -) -@armCommonDefinition( - "PrivateLinkResourceProperties", - Azure.ResourceManager.CommonTypes.Versions.v5, - "privatelinks.json" -) -model PrivateLinkResourceProperties { - /** The private link resource group id. */ - @visibility("read") - groupId?: string; - - /** The private link resource required member names. */ - @visibility("read") - requiredMembers?: string[]; - - /** The private link resource private link DNS zone name. */ - requiredZoneNames?: string[]; -} - -/** List of private endpoint connections associated with the specified resource. */ -model PrivateEndpointConnectionResourceListResult { - /** Array of private endpoint connections */ - value?: PrivateEndpointConnection[]; -} - -/** A list of private link resources. */ -model PrivateLinkResourceListResult { - /** Array of private link resources */ - value?: PrivateLinkResource[]; -} - /** * The name of the private endpoint connection associated with the Azure resource. * @template Segment The resource type name for private endpoint connections (default is privateEndpointConnections) */ +@added(CommonTypes.Versions.v4) model PrivateEndpointConnectionParameter { /** The name of the private endpoint connection associated with the Azure resource. */ @path - @armCommonParameter( - "PrivateEndpointConnectionName", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "privatelinks.json" - ) - @armCommonParameter( - "PrivateEndpointConnectionName", - Azure.ResourceManager.CommonTypes.Versions.v5, - "privatelinks.json" - ) @TypeSpec.Rest.segment(Segment) @key("privateEndpointConnectionName") name: string; @@ -178,6 +95,7 @@ model PrivateEndpointConnectionParameter { /** The name of the private link associated with the Azure resource. */ @path diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp new file mode 100644 index 0000000000..50ee81f61c --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp @@ -0,0 +1,129 @@ +import "../private.decorators.tsp"; +import "./common-types.tsp"; +import "./types.tsp"; + +using Azure.ResourceManager.CommonTypes.Private; + +namespace Azure.ResourceManager.Foundations; + +/** Common resource fields that are returned in the response for all Azure Resource Manager resources. */ +@@armCommonDefinition(Resource, "Resource", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(Resource, "Resource", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(Resource, "Resource", Azure.ResourceManager.CommonTypes.Versions.v5); + + +/** The resource model definition for an Azure Resource Manager resource with an etag. */ +@@armCommonDefinition(AzureEntityResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(AzureEntityResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(AzureEntityResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The base tracked resource. + */ +@@armCommonDefinition(TrackedResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(TrackedResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(TrackedResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The base proxy resource. + */ +@@armCommonDefinition(ProxyResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(ProxyResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(ProxyResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The base extension resource. + */ +@@armCommonDefinition(ExtensionResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(ExtensionResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(ExtensionResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The SKU (Stock Keeping Unit) assigned to this resource. + */ + +@@armCommonDefinition(Sku, "Sku", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(Sku, "Sku", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(Sku, "Sku", Azure.ResourceManager.CommonTypes.Versions.v5); + + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + */ +@@armCommonDefinition(OperationListResult,"OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(OperationListResult,"OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(OperationListResult,"OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v5); + + +/** + * Details of a REST API operation, returned from the Resource Provider Operations API + */ +@@armCommonDefinition(Operation,"Operation", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(Operation,"Operation", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(Operation,"Operation", Azure.ResourceManager.CommonTypes.Versions.v5); + + +/** + * Localized display information for and operation. + */ +@@armCommonDefinition(OperationDisplay, "OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(OperationDisplay, "OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(OperationDisplay, "OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The current status of an async operation. + */ +@@armCommonDefinition(OperationStatusResult, "OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(OperationStatusResult, "OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(OperationStatusResult, "OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The default operationId parameter type. + */ +@@armCommonDefinition(OperationIdParameter, "OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(OperationIdParameter, "OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(OperationIdParameter, "OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v5); + + +/** + * The error detail. + */ +@@armCommonDefinition(ErrorDetail, "ErrorDetail", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(ErrorDetail, "ErrorDetail", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(ErrorDetail, "ErrorDetail", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The resource management error additional info. + */ +@@armCommonDefinition(ErrorAdditionalInfo, "ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(ErrorAdditionalInfo, "ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(ErrorAdditionalInfo, "ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * Metadata pertaining to creation and last modification of the resource. + */ +@@armCommonDefinition(SystemData, "systemData", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(SystemData, "systemData", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(SystemData,"systemData", Azure.ResourceManager.CommonTypes.Versions.v5); + + +/** + * Details of the resource plan. + */ +@@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(Plan,"Plan", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The check availability request body. + */ +@@armCommonDefinition(CheckNameAvailabilityRequest, "CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(CheckNameAvailabilityRequest, "CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(CheckNameAvailabilityRequest, "CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v5); + +/** + * The check availability result. + */ +@@armCommonDefinition(CheckNameAvailabilityResponse, "CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(CheckNameAvailabilityResponse, "CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(CheckNameAvailabilityResponse, "CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v5); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index fa9ef37b0d..ae353ac13f 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -1,36 +1,41 @@ using TypeSpec.Http; using TypeSpec.OpenAPI; +using TypeSpec.Versioning; using Azure.Core; using Azure.ResourceManager.Private; -namespace Azure.ResourceManager.Foundations; +namespace Azure.ResourceManager.CommonTypes; /** * Base model that defines common properties for all Azure Resource Manager resources. */ -@doc("Common properties for all Azure Resource Manager resources.") +/** Common properties for all Azure Resource Manager resources. */ model Resource { - @doc("Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}") + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + @renamedFrom(Versions.v3, "id") + @removed(Versions.v4) @visibility("read") - id?: string; + idV3?: string; + + /** Fully qualified resource ID for the resource. E.g. \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}\" */ + @added(CommonTypes.Versions.v4) + @visibility("read") + id?: uuid; - @doc("The name of the resource") + /** The name of the resource */ @visibility("read") name?: string; - @doc("The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\"") + /** The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\ */ @visibility("read") type?: string; - @doc("Azure Resource Manager metadata containing createdBy and modifiedBy information.") + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ @visibility("read") systemData?: SystemData; } /** The resource model definition for an Azure Resource Manager resource with an etag. */ -@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v5) model AzureEntityResource extends Resource { /** Resource Etag. */ @visibility("read") @@ -42,21 +47,18 @@ model AzureEntityResource extends Resource { * * It is included in the TrackedResource template definition. */ -@doc("The Azure Resource Manager Resource tags.") +/** The Azure Resource Manager Resource tags. */ model ArmTagsProperty { - @doc("Resource tags.") + /** Resource tags. */ tags?: Record; } /** * The base tracked resource. */ -@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'") +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ model TrackedResource extends Resource { - @doc("The geo-location where the resource lives") + /** The geo-location where the resource lives */ @visibility("read", "create") location: string; @@ -66,194 +68,170 @@ model TrackedResource extends Resource { /** * The base proxy resource. */ -@doc("The base proxy resource.") -@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v5) +/** The base proxy resource. */ model ProxyResource extends Resource {} /** * The base extension resource. */ // Note that ProxyResource is the base definition for both kinds of resources -@doc("The base extension resource.") -@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v5) +/** The base extension resource. */ model ExtensionResource extends Resource {} /** * The SKU (Stock Keeping Unit) assigned to this resource. */ -@doc("The SKU (Stock Keeping Unit) assigned to this resource.") -@armCommonDefinition("Sku", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("Sku", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("Sku", Azure.ResourceManager.CommonTypes.Versions.v5) +/** The SKU (Stock Keeping Unit) assigned to this resource. */ model Sku { - @doc("The name of the SKU, usually a combination of letters and numbers, for example, 'P3'") + /** The name of the SKU, usually a combination of letters and numbers, for example, 'P3' */ name: string; - @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.") + /** 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. */ tier?: SkuTier; - @doc("The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code.") + /** The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. */ size?: string; - @doc("If the service has different generations of hardware, for the same SKU, then that can be captured here.") + /** If the service has different generations of hardware, for the same SKU, then that can be captured here. */ family?: string; - @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.") + /** 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. */ capacity?: int32; } /** * Available service tiers for the SKU. */ -@doc("Available service tiers for the SKU.") +/** Available service tiers for the SKU. */ enum SkuTier { - @doc("The Free service tier.") + /** The Free service tier. */ Free, - @doc("The Basic service tier.") + /** The Basic service tier. */ Basic, - @doc("The Standard service tier.") + /** The Standard service tier. */ Standard, - @doc("The Premium service tier.") + /** The Premium service tier. */ Premium, } /** * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -@armCommonDefinition("OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc(""" +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. -""") + */ model OperationListResult is Azure.Core.Page; /** * Details of a REST API operation, returned from the Resource Provider Operations API */ -@armCommonDefinition("Operation", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("Operation", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("Operation", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("Details of a REST API operation, returned from the Resource Provider Operations API") +/** Details of a REST API operation, returned from the Resource Provider Operations API */ model Operation { - @doc(""" + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - """) + */ @visibility("read") name?: string; - @doc(""" + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. - """) + */ @visibility("read") isDataAction?: boolean; - @doc("Localized display information for this particular operation.") + /** Localized display information for this particular operation. */ display?: OperationDisplay; - @doc(""" + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - """) + */ @visibility("read") origin?: Origin; - @doc(""" + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """) + */ actionType?: ActionType; } /** * Localized display information for and operation. */ -@armCommonDefinition("OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("Localized display information for and operation.") +/** Localized display information for and operation. */ model OperationDisplay { - @doc(""" + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - """) + */ provider?: string; - @doc(""" + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - """) + */ resource?: string; - @doc(""" + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - """) + */ operation?: string; - @doc("The short, localized friendly description of the operation; suitable for tool tips and detailed views.") + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ description?: string; } /** * The current status of an async operation. */ -@armCommonDefinition("OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("The current status of an async operation.") +/** The current status of an async operation. */ model OperationStatusResult { - @doc("Fully qualified ID for the async operation.") + /** Fully qualified ID for the async operation. */ id?: string; - @doc("Name of the async operation.") + /** Name of the async operation. */ name?: string; - @doc("Operation status.") + /** Operation status. */ status: string; - @doc("Percent of the operation that is complete.") + /** Percent of the operation that is complete. */ @minValue(0) @maxValue(100) percentComplete?: float64; - @doc("The start time of the operation.") + /** The start time of the operation. */ startTime?: utcDateTime; - @doc("The end time of the operation.") + /** The end time of the operation. */ endTime?: utcDateTime; - @doc("The operations list.") + /** The operations list. */ operations: OperationStatusResult[]; - @doc("If present, details of the operation error.") + /** If present, details of the operation error. */ error?: ErrorDetail; } /** * The default operationId parameter type. */ -@doc("The default operationId parameter type.") +/** The default operationId parameter type. */ model OperationIdParameter { + /** The ID of an ongoing async operation. */ @path @minLength(1) - @doc("The ID of an ongoing async operation.") - @armCommonParameter("OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v3) - @armCommonParameter("OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v4) - @armCommonParameter("OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v5) operationId: string; } /** * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ -@doc(""" +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -""") + */ union ActionType { - @doc("Actions are for internal-only APIs.") + /** Actions are for internal-only APIs. */ Internal: "Internal", string, @@ -262,17 +240,17 @@ union ActionType { /** * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ -@doc(""" +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" -""") + */ union Origin { - @doc("Indicates the operation is initiated by a user.") + /** Indicates the operation is initiated by a user. */ user: "user", - @doc("Indicates the operation is initiated by a system.") + /** Indicates the operation is initiated by a system. */ system: "system", - @doc("Indicates the operation is initiated by a user or system.") + /** Indicates the operation is initiated by a user or system. */ `user,system`: "user,system", string, @@ -281,30 +259,27 @@ union Origin { /** * The error detail. */ -@armCommonDefinition("ErrorDetail", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("ErrorDetail", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("ErrorDetail", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("The error detail.") +/** The error detail. */ model ErrorDetail { - @doc("The error code.") + /** The error code. */ @visibility("read") code?: string; - @doc("The error message.") + /** The error message. */ @visibility("read") message?: string; - @doc("The error target.") + /** The error target. */ @visibility("read") target?: string; + /** The error details. */ @extension("x-ms-identifiers", ["message", "target"]) - @doc("The error details.") @visibility("read") details?: ErrorDetail[]; + /** The error additional info. */ @extension("x-ms-identifiers", ["message", "target"]) - @doc("The error additional info.") @visibility("read") additionalInfo?: ErrorAdditionalInfo[]; } @@ -312,16 +287,13 @@ model ErrorDetail { /** * The resource management error additional info. */ -@armCommonDefinition("ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("The resource management error additional info.") +/** The resource management error additional info. */ model ErrorAdditionalInfo { - @doc("The additional info type.") + /** The additional info type. */ @visibility("read") type?: string; - @doc("The additional info.") + /** The additional info. */ @visibility("read") info?: {}; } @@ -329,33 +301,30 @@ model ErrorAdditionalInfo { /** * Metadata pertaining to creation and last modification of the resource. */ -@armCommonDefinition("systemData", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("systemData", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("systemData", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("Metadata pertaining to creation and last modification of the resource.") +/** Metadata pertaining to creation and last modification of the resource. */ model SystemData { + /** The identity that created the resource. */ @visibility("read") - @doc("The identity that created the resource.") createdBy?: string; + /** The type of identity that created the resource. */ @visibility("read") - @doc("The type of identity that created the resource.") createdByType?: createdByType; + /** The type of identity that created the resource. */ @visibility("read") - @doc("The type of identity that created the resource.") createdAt?: plainDate; + /** The identity that last modified the resource. */ @visibility("read") - @doc("The identity that last modified the resource.") lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ @visibility("read") - @doc("The type of identity that last modified the resource.") lastModifiedByType?: createdByType; + /** The timestamp of resource last modification (UTC) */ @visibility("read") - @doc("The timestamp of resource last modification (UTC)") lastModifiedAt?: plainDate; } @@ -363,89 +332,87 @@ model SystemData { * The kind of entity that created the resource. */ // NOTE: This is how the extensible enum is named in types.json -@doc("The kind of entity that created the resource.") +/** The kind of entity that created the resource. */ union createdByType { - @doc("The entity was created by a user.") + /** The entity was created by a user. */ User: "User", - @doc("The entity was created by an application.") + /** The entity was created by an application. */ Application: "Application", - @doc("The entity was created by a managed identity.") + /** The entity was created by a managed identity. */ ManagedIdentity: "ManagedIdentity", - @doc("The entity was created by a key.") + /** The entity was created by a key. */ Key: "Key", string, } +// /** Identity for the resource. */ +// model Identity { +// principalId?: string; +// tenantId?: string; +// type?: enum {SystemAssigned} +// } + /** * Details of the resource plan. */ -@doc("Details of the resource plan.") -@armCommonDefinition("Plan", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("Plan", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("Plan", Azure.ResourceManager.CommonTypes.Versions.v5) +/** Details of the resource plan. */ model Plan { - @doc("A user defined name of the 3rd Party Artifact that is being procured.") + /** A user defined name of the 3rd Party Artifact that is being procured. */ name: string; - @doc("The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic") + /** The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic */ publisher: string; - @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. ") + /** 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. */ product: string; - @doc("A publisher provided promotion code as provisioned in Data Market for the said product/artifact.") + /** A publisher provided promotion code as provisioned in Data Market for the said product/artifact. */ promotionCode?: string; - @doc("The version of the desired product/artifact.") + /** The version of the desired product/artifact. */ version?: string; } /** * The check availability request body. */ -@armCommonDefinition("CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("The check availability request body.") +/** The check availability request body. */ model CheckNameAvailabilityRequest { - @doc("The name of the resource for which availability needs to be checked.") + /** The name of the resource for which availability needs to be checked. */ name?: string; - @doc("The resource type.") + /** The resource type. */ type?: string; } /** * The check availability result. */ -@armCommonDefinition("CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc("The check availability result.") +/** The check availability result. */ model CheckNameAvailabilityResponse { - @doc("Indicates if the resource name is available.") + /** Indicates if the resource name is available. */ nameAvailable?: boolean; - @doc("The reason why the given name is not available.") + /** The reason why the given name is not available. */ reason?: CheckNameAvailabilityReason; - @doc("Detailed reason why the given name is not available.") + /** Detailed reason why the given name is not available. */ message?: string; } /** * Possible reasons for a name not being available. */ -@doc("Possible reasons for a name not being available.") +/** Possible reasons for a name not being available. */ union CheckNameAvailabilityReason { - @doc("Name is invalid.") + /** Name is invalid. */ Invalid: "Invalid", - @doc("Name already exists.") + /** Name already exists. */ AlreadyExists: "AlreadyExists", string, diff --git a/packages/typespec-azure-resource-manager/lib/decorators.tsp b/packages/typespec-azure-resource-manager/lib/decorators.tsp index 027cd9c75d..ad954c60b4 100644 --- a/packages/typespec-azure-resource-manager/lib/decorators.tsp +++ b/packages/typespec-azure-resource-manager/lib/decorators.tsp @@ -180,12 +180,9 @@ extern dec armResourceOperations(target: Interface, _?: unknown); * This decorator is used either on a namespace or a version enum value to indicate * the version of the Azure Resource Manager common-types to use for refs in emitted Swagger files. * - * @param version The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version or an equivalent string value. + * @param version The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. */ -extern dec armCommonTypesVersion( - target: Namespace | EnumMember, - version: valueof string | EnumMember -); +extern dec armCommonTypesVersion(target: Namespace | EnumMember, version: EnumMember); /** * This decorator is used on Azure Resource Manager resources that are not based on diff --git a/packages/typespec-azure-resource-manager/lib/arm.foundations.tsp b/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp similarity index 96% rename from packages/typespec-azure-resource-manager/lib/arm.foundations.tsp rename to packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp index 47fdbf802f..b79cada82f 100644 --- a/packages/typespec-azure-resource-manager/lib/arm.foundations.tsp +++ b/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp @@ -1,6 +1,17 @@ +import "@typespec/openapi"; +import "@typespec/http"; +import "@typespec/rest"; + +import "./backcompat.tsp"; +import "./deprecation.tsp"; +import "../common-types/common-types.tsp"; +import "../decorators.tsp"; +import "../responses.tsp"; +import "../private.decorators.tsp"; +import "../parameters.tsp"; + using TypeSpec.Http; using TypeSpec.OpenAPI; -using TypeSpec.Versioning; using Azure.ResourceManager.Private; namespace Azure.ResourceManager.Foundations; diff --git a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp new file mode 100644 index 0000000000..41c61bcc4a --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp @@ -0,0 +1,42 @@ +using Azure.ResourceManager.CommonTypes; + +namespace Azure.ResourceManager.Foundations { + // extended-location + alias ExtendedLocation = CommonTypes.ExtendedLocation; + alias ExtendedLocationType = CommonTypes.ExtendedLocationType; + + // managed-identities + alias ManagedServiceIdentity = CommonTypes.ManagedServiceIdentity; + #suppress "deprecated" "Need for back compatibility in common-types" + alias UserAssignedIdentities = CommonTypes.UserAssignedIdentities; + alias SystemAssignedServiceIdentity = CommonTypes.SystemAssignedServiceIdentity; + alias UserAssignedIdentity = CommonTypes.UserAssignedIdentity; + alias ManagedServiceIdentityType = CommonTypes.ManagedServiceIdentityType; + alias SystemAssignedServiceIdentityType = CommonTypes.SystemAssignedServiceIdentityType; + alias ManagedSystemIdentityType = SystemAssignedServiceIdentityType; + + // types + alias Resource = CommonTypes.Resource; + alias AzureEntityResource = CommonTypes.AzureEntityResource; + alias ArmTagsProperty = CommonTypes.ArmTagsProperty; + alias TrackedResource = CommonTypes.TrackedResource; + alias ProxyResource = CommonTypes.ProxyResource; + alias ExtensionResource = CommonTypes.ExtensionResource; + alias Sku = CommonTypes.Sku; + alias SkuTier = CommonTypes.SkuTier; + alias OperationListResult = CommonTypes.OperationListResult; + alias Operation = CommonTypes.Operation; + alias OperationDisplay = CommonTypes.OperationDisplay; + alias OperationStatusResult = CommonTypes.OperationStatusResult; + alias OperationIdParameter = CommonTypes.OperationIdParameter; + alias ActionType = CommonTypes.ActionType; + alias Origin = CommonTypes.Origin; + alias ErrorDetail = CommonTypes.ErrorDetail; + alias ErrorAdditionalInfo = CommonTypes.ErrorAdditionalInfo; + alias SystemData = CommonTypes.SystemData; + alias createdByType = CommonTypes.createdByType; + alias Plan = CommonTypes.Plan; + alias CheckNameAvailabilityRequest = CommonTypes.CheckNameAvailabilityRequest; + alias CheckNameAvailabilityResponse = CommonTypes.CheckNameAvailabilityResponse; + alias CheckNameAvailabilityReason = CommonTypes.CheckNameAvailabilityReason; +} diff --git a/packages/typespec-azure-resource-manager/lib/common-types/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/foundations/deprecation.tsp similarity index 59% rename from packages/typespec-azure-resource-manager/lib/common-types/backcompat.tsp rename to packages/typespec-azure-resource-manager/lib/foundations/deprecation.tsp index bca365485f..e9f0d74cec 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/foundations/deprecation.tsp @@ -17,3 +17,14 @@ alias ResourceSkuType = Sku; #deprecated "Please use Foundations.Plan instead of Foundations.ResourcePlanType" alias ResourcePlanType = Plan; + +// managed-identity +#deprecated "Please change ManagedIdentityProperties to ManagedServiceIdentity." +alias ManagedIdentityProperties = ManagedServiceIdentity; + +#deprecated "Please change ManagedSystemIdentityProperties to SystemAssignedServiceIdentity." +alias ManagedSystemIdentityProperties = SystemAssignedServiceIdentity; + +/** Alias of ManagedServiceIdentityType for back compatability. Please change to ManagedServiceIdentityType. */ +#deprecated "Please change to ManagedServiceIdentityType." +alias ManagedIdentityType = ManagedServiceIdentityType; diff --git a/packages/typespec-azure-resource-manager/lib/models.tsp b/packages/typespec-azure-resource-manager/lib/models.tsp index 5b8e266048..2e0c586f70 100644 --- a/packages/typespec-azure-resource-manager/lib/models.tsp +++ b/packages/typespec-azure-resource-manager/lib/models.tsp @@ -80,6 +80,40 @@ model ExtensionResource extends Foundations.ExtensionReso } //#region +//#region Private Link models +model PrivateLinkResource extends Foundations.ProxyResource { + /** Properties of the private link resource. */ + properties?: PrivateLinkResourceProperties; +} + +/** Properties of a private link resource. */ +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Matches current common code" +model PrivateLinkResourceProperties { + /** The private link resource group id. */ + @visibility("read") + groupId?: string; + + /** The private link resource required member names. */ + @visibility("read") + requiredMembers?: string[]; + + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +/** List of private endpoint connections associated with the specified resource. */ +model PrivateEndpointConnectionResourceListResult { + /** Array of private endpoint connections */ + value?: PrivateEndpointConnection[]; +} + +/** A list of private link resources. */ +model PrivateLinkResourceListResult { + /** Array of private link resources */ + value?: PrivateLinkResource[]; +} +//#region + //#region Standard extraction models /** diff --git a/packages/typespec-azure-resource-manager/lib/parameters.tsp b/packages/typespec-azure-resource-manager/lib/parameters.tsp index 79788ad073..1827ec6e90 100644 --- a/packages/typespec-azure-resource-manager/lib/parameters.tsp +++ b/packages/typespec-azure-resource-manager/lib/parameters.tsp @@ -3,6 +3,8 @@ using TypeSpec.Rest; using TypeSpec.OpenAPI; using Azure.ResourceManager.Foundations; using Azure.ResourceManager.Private; +using Azure.ResourceManager.CommonTypes; +using Azure.ResourceManager.CommonTypes.Private; namespace Azure.ResourceManager; diff --git a/packages/typespec-azure-resource-manager/lib/private.decorators.tsp b/packages/typespec-azure-resource-manager/lib/private.decorators.tsp index fdfcbd4d15..7993ea6bbb 100644 --- a/packages/typespec-azure-resource-manager/lib/private.decorators.tsp +++ b/packages/typespec-azure-resource-manager/lib/private.decorators.tsp @@ -14,39 +14,6 @@ extern dec armUpdateProviderNamespace(target: Reflection.Operation); */ extern dec assignProviderNameValue(target: ModelProperty, resource: Model); -/** - * Describes the shape of model literals accepted by the `version` parameter of - * the `armCommonDefinition` and `armCommonParameter` decorators. - */ -alias ArmCommonTypeVersionSpec = { - version: string | EnumMember; - isDefault: boolean; -}; - -/** - * @param definitionName Definition name - * @param version Azure Resource Manager Version - * @param referenceFile Reference file - */ -extern dec armCommonDefinition( - target: Model, - definitionName?: valueof string, - version?: valueof EnumMember | ArmCommonTypeVersionSpec | string, - referenceFile?: valueof string -); - -/** - * @param definitionName Definition name - * @param version Azure Resource Manager Version - * @param referenceFile Reference file - */ -extern dec armCommonParameter( - target: ModelProperty, - definitionName?: valueof string, - version?: valueof EnumMember | ArmCommonTypeVersionSpec | string, - referenceFile?: valueof string -); - /** * This decorator is used to identify Azure Resource Manager resource types and extract their * 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); */ extern dec resourceParameterBaseFor(target: ModelProperty, values: unknown[]); -/** - * Marks an enum as representing the valid `common-types` versions. - */ -extern dec armCommonTypesVersions(target: Enum); - /** * Provides default name decoration on resource name property with * camelcased and pluralized key and segment name diff --git a/packages/typespec-azure-resource-manager/lib/responses.tsp b/packages/typespec-azure-resource-manager/lib/responses.tsp index 7a3a6306e6..2d2eb91286 100644 --- a/packages/typespec-azure-resource-manager/lib/responses.tsp +++ b/packages/typespec-azure-resource-manager/lib/responses.tsp @@ -3,6 +3,7 @@ using TypeSpec.Rest; using TypeSpec.OpenAPI; using Azure.ResourceManager.Foundations; using Azure.ResourceManager.Private; +using Azure.ResourceManager.CommonTypes.Private; namespace Azure.ResourceManager; diff --git a/packages/typespec-azure-resource-manager/scripts/common-types.tsp b/packages/typespec-azure-resource-manager/scripts/common-types.tsp new file mode 100644 index 0000000000..ba73dc893a --- /dev/null +++ b/packages/typespec-azure-resource-manager/scripts/common-types.tsp @@ -0,0 +1,29 @@ +import "@typespec/openapi"; +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using TypeSpec.OpenAPI; + +@versioned(Azure.ResourceManager.Foundations.Versions) +@service() +namespace Azure.ResourceManager.Foundations; + +/** + * Supported versions of Azure.ResourceManager building blocks. + */ +@doc("Supported versions of Azure.ResourceManager building blocks.") +enum Versions { + @doc("ARM common types v3") + v3, + + @doc("ARM common types v3") + v4, + + @doc("ARM common types v3") + v5, +} diff --git a/packages/typespec-azure-resource-manager/scripts/generate-common-types.js b/packages/typespec-azure-resource-manager/scripts/generate-common-types.js new file mode 100644 index 0000000000..26338d39f4 --- /dev/null +++ b/packages/typespec-azure-resource-manager/scripts/generate-common-types.js @@ -0,0 +1,23 @@ +async function generateCommonTypesSwagger(packages) { + const basicLatestDir = join(e2eTestDir, "basic-latest"); + const outputDir = join(basicLatestDir, "tsp-output"); + console.log("Clearing basic-latest output"); + rmSync(outputDir, { recursive: true, force: true }); + console.log("Cleared basic-latest output"); + + console.log("Installing basic-latest dependencies"); + await runTypeSpec(packages["@typespec/compiler"], ["install"], { cwd: basicLatestDir }); + console.log("Installed basic-latest dependencies"); + + console.log("Running tsp compile ."); + await runTypeSpec( + packages["@typespec/compiler"], + ["compile", ".", "--emit", "@typespec/openapi3"], + { + cwd: basicLatestDir, + } + ); + console.log("Completed tsp compile ."); + + expectOpenApiOutput(outputDir); +} diff --git a/packages/typespec-azure-resource-manager/src/common-types.ts b/packages/typespec-azure-resource-manager/src/common-types.ts index 1bd346e990..3f2d23cfed 100644 --- a/packages/typespec-azure-resource-manager/src/common-types.ts +++ b/packages/typespec-azure-resource-manager/src/common-types.ts @@ -12,13 +12,13 @@ import { Type, isTypeSpecValueTypeOf, } from "@typespec/compiler"; -import { getVersion } from "@typespec/versioning"; -import { createDiagnostic } from "./lib.js"; +import { $useDependency, getVersion } from "@typespec/versioning"; import { ArmCommonTypeRecord, ArmCommonTypesDefaultVersion, getCommonTypeRecords, -} from "./private.decorators.js"; +} from "./commontypes.private.decorators.js"; +import { createDiagnostic } from "./lib.js"; import { ArmStateKeys } from "./state.js"; export interface ArmCommonTypeVersions { @@ -56,11 +56,11 @@ export function isArmCommonType(entity: Type): boolean { export function $armCommonTypesVersion( context: DecoratorContext, entity: Namespace | EnumMember, - version: string | EnumValue + version: EnumValue ) { - context.program - .stateMap(ArmStateKeys.armCommonTypesVersion) - .set(entity, typeof version === "string" ? version : version.value.name); + context.program.stateMap(ArmStateKeys.armCommonTypesVersion).set(entity, version.value.name); + + context.call($useDependency, entity, version.value); } /** diff --git a/packages/typespec-azure-resource-manager/src/commontypes.private.decorators.ts b/packages/typespec-azure-resource-manager/src/commontypes.private.decorators.ts new file mode 100644 index 0000000000..326a380203 --- /dev/null +++ b/packages/typespec-azure-resource-manager/src/commontypes.private.decorators.ts @@ -0,0 +1,135 @@ +import { + DecoratorContext, + Enum, + EnumValue, + Model, + ModelProperty, + Program, +} from "@typespec/compiler"; +import { ArmStateKeys } from "./state.js"; + +export const namespace = "Azure.ResourceManager.CommonTypes.Private"; + +export const ArmCommonTypesDefaultVersion = "v3"; + +function getArmTypesPath(program: Program): string { + return program.getOption("arm-types-path") || "{arm-types-dir}"; +} + +function storeCommonTypeRecord( + context: DecoratorContext, + entity: Model | ModelProperty, + kind: "definitions" | "parameters", + name: string, + version?: string | EnumValue | ArmCommonTypeVersionSpec, + referenceFile?: string +): void { + const basePath: string = getArmTypesPath(context.program).trim(); + + // NOTE: Right now we don't try to prevent multiple versions from declaring that they are the default + let isDefault = false; + if (version && typeof version !== "string" && !("valueKind" in version)) { + isDefault = !!version.isDefault; + version = version.version; + } + + // for backward compatibility, skip if we are trying to access a non-default file and emit the type + if ((version || referenceFile) && basePath.endsWith(".json")) return; + if (!version) version = ArmCommonTypesDefaultVersion; + if (!referenceFile) referenceFile = "types.json"; + + const versionStr = typeof version === "string" ? version : version.value.name; + const records = getCommonTypeRecords(context.program, entity); + + records.records[versionStr] = { + name, + kind, + version: versionStr, + basePath, + referenceFile, + }; + if (isDefault) { + records.defaultKey = versionStr; + } + context.program.stateMap(ArmStateKeys.armCommonDefinitions).set(entity, records); +} + +export interface ArmCommonTypeRecord { + name: string; + kind: "definitions" | "parameters"; + version: string; + basePath: string; + referenceFile?: string; +} + +export interface ArmCommonTypeRecords { + records: { [key: string]: ArmCommonTypeRecord }; + defaultKey?: string; +} + +export function getCommonTypeRecords( + program: Program, + entity: Model | ModelProperty +): ArmCommonTypeRecords { + return program.stateMap(ArmStateKeys.armCommonDefinitions).get(entity) ?? { records: {} }; +} + +interface ArmCommonTypeVersionSpec { + version: string | EnumValue; + isDefault: boolean; +} + +/** + * Refer an model property to be a common ARM parameter + * @param {DecoratorContext} context DecoratorContext object + * @param {Type} entity Decorator target type. Must be `Model` + * @param {string?} definitionName Optional definition name + * @param {string?} version Optional version + * @param {string?} referenceFile Optional common file path + * @returns void + */ +export function $armCommonParameter( + context: DecoratorContext, + entity: ModelProperty, + parameterName?: string, + version?: string | EnumValue | ArmCommonTypeVersionSpec, + referenceFile?: string +): void { + // Use the name of the model type if not specified + if (!parameterName) { + parameterName = entity.name; + } + + storeCommonTypeRecord(context, entity, "parameters", parameterName, version, referenceFile); +} + +/** + * Using ARM common definition for a Model + * @param {DecoratorContext} context DecoratorContext object + * @param {Type} entity Decorator target type. Must be `Model` + * @param {string?} definitionName Optional definition name + * @param {string?} version Optional version + * @param {string?} referenceFile Optional common file path + * @returns {void} + */ +export function $armCommonDefinition( + context: DecoratorContext, + entity: Model, + definitionName?: string, + version?: string | EnumValue | ArmCommonTypeVersionSpec, + referenceFile?: string +): void { + // Use the name of the model type if not specified + if (!definitionName) { + definitionName = entity.name; + } + + storeCommonTypeRecord(context, entity, "definitions", definitionName, version, referenceFile); +} + +export function $armCommonTypesVersions(context: DecoratorContext, enumType: Enum) { + context.program.stateMap(ArmStateKeys.armCommonTypesVersions).set(enumType, { + type: enumType, + allVersions: Array.from(enumType.members.values()).reverse(), + }); +} diff --git a/packages/typespec-azure-resource-manager/src/private.decorators.ts b/packages/typespec-azure-resource-manager/src/private.decorators.ts index 4aa53d8548..cd829d7d01 100644 --- a/packages/typespec-azure-resource-manager/src/private.decorators.ts +++ b/packages/typespec-azure-resource-manager/src/private.decorators.ts @@ -2,8 +2,6 @@ import { $key, $visibility, DecoratorContext, - Enum, - EnumValue, Interface, Model, ModelProperty, @@ -31,8 +29,6 @@ import { ArmStateKeys } from "./state.js"; export const namespace = "Azure.ResourceManager.Private"; -export const ArmCommonTypesDefaultVersion = "v3"; - export function $omitIfEmpty(context: DecoratorContext, entity: Model, propertyName: string) { const modelProp = getProperty(entity, propertyName); @@ -164,117 +160,6 @@ function getArmTypesPath(program: Program): string { return program.getOption("arm-types-path") || "{arm-types-dir}"; } -function storeCommonTypeRecord( - context: DecoratorContext, - entity: Model | ModelProperty, - kind: "definitions" | "parameters", - name: string, - version?: string | EnumValue | ArmCommonTypeVersionSpec, - referenceFile?: string -): void { - const basePath: string = getArmTypesPath(context.program).trim(); - - // NOTE: Right now we don't try to prevent multiple versions from declaring that they are the default - let isDefault = false; - if (version && typeof version !== "string" && !("valueKind" in version)) { - isDefault = !!version.isDefault; - version = version.version; - } - - // for backward compatibility, skip if we are trying to access a non-default file and emit the type - if ((version || referenceFile) && basePath.endsWith(".json")) return; - if (!version) version = ArmCommonTypesDefaultVersion; - if (!referenceFile) referenceFile = "types.json"; - - const versionStr = typeof version === "string" ? version : version.value.name; - const records = getCommonTypeRecords(context.program, entity); - - records.records[versionStr] = { - name, - kind, - version: versionStr, - basePath, - referenceFile, - }; - if (isDefault) { - records.defaultKey = versionStr; - } - context.program.stateMap(ArmStateKeys.armCommonDefinitions).set(entity, records); -} - -export interface ArmCommonTypeRecord { - name: string; - kind: "definitions" | "parameters"; - version: string; - basePath: string; - referenceFile?: string; -} - -export interface ArmCommonTypeRecords { - records: { [key: string]: ArmCommonTypeRecord }; - defaultKey?: string; -} - -export function getCommonTypeRecords( - program: Program, - entity: Model | ModelProperty -): ArmCommonTypeRecords { - return program.stateMap(ArmStateKeys.armCommonDefinitions).get(entity) ?? { records: {} }; -} - -interface ArmCommonTypeVersionSpec { - version: string | EnumValue; - isDefault: boolean; -} - -/** - * Refer an model property to be a common ARM parameter - * @param {DecoratorContext} context DecoratorContext object - * @param {Type} entity Decorator target type. Must be `Model` - * @param {string?} definitionName Optional definition name - * @param {string?} version Optional version - * @param {string?} referenceFile Optional common file path - * @returns void - */ -export function $armCommonParameter( - context: DecoratorContext, - entity: ModelProperty, - parameterName?: string, - version?: string | EnumValue | ArmCommonTypeVersionSpec, - referenceFile?: string -): void { - // Use the name of the model type if not specified - if (!parameterName) { - parameterName = entity.name; - } - - storeCommonTypeRecord(context, entity, "parameters", parameterName, version, referenceFile); -} - -/** - * Using ARM common definition for a Model - * @param {DecoratorContext} context DecoratorContext object - * @param {Type} entity Decorator target type. Must be `Model` - * @param {string?} definitionName Optional definition name - * @param {string?} version Optional version - * @param {string?} referenceFile Optional common file path - * @returns {void} - */ -export function $armCommonDefinition( - context: DecoratorContext, - entity: Model, - definitionName?: string, - version?: string | EnumValue | ArmCommonTypeVersionSpec, - referenceFile?: string -): void { - // Use the name of the model type if not specified - if (!definitionName) { - definitionName = entity.name; - } - - storeCommonTypeRecord(context, entity, "definitions", definitionName, version, referenceFile); -} - /** * This decorator dynamically assigns the serviceNamespace from the containing * namespace to the string literal value of the path parameter to which this @@ -469,10 +354,3 @@ function hasProperty(program: Program, model: Model): boolean { if (model.baseModel) return hasProperty(program, model.baseModel); return false; } - -export function $armCommonTypesVersions(context: DecoratorContext, enumType: Enum) { - context.program.stateMap(ArmStateKeys.armCommonTypesVersions).set(enumType, { - type: enumType, - allVersions: Array.from(enumType.members.values()).reverse(), - }); -} diff --git a/packages/typespec-azure-resource-manager/test/arm-common-types-registration.test.ts b/packages/typespec-azure-resource-manager/test/arm-common-types-registration.test.ts index f5b3adb969..e9588245e7 100644 --- a/packages/typespec-azure-resource-manager/test/arm-common-types-registration.test.ts +++ b/packages/typespec-azure-resource-manager/test/arm-common-types-registration.test.ts @@ -3,7 +3,7 @@ import { getService } from "@typespec/compiler"; import { expectDiagnosticEmpty, expectDiagnostics } from "@typespec/compiler/testing"; import { describe, expect, it } from "vitest"; import { findArmCommonTypeRecord } from "../src/common-types.js"; -import type { ArmCommonTypeRecord } from "../src/private.decorators.js"; +import type { ArmCommonTypeRecord } from "../src/commontypes.private.decorators.js"; import { createAzureResourceManagerTestRunner } from "./test-host.js"; function boilerplate(version: string | undefined) { From 0dd9110d11427117e912e3edd6b13dafc071969d Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Thu, 30 May 2024 11:51:22 -0700 Subject: [PATCH 02/25] Fixed common $ref generation --- .../lib/common-types/common-types.tsp | 2 + .../lib/common-types/internal.tsp | 21 ++ .../lib/common-types/types-ref.tsp | 212 ++++++++++++++---- .../lib/common-types/types.tsp | 40 ++++ .../lib/foundations/arm.foundations.tsp | 20 -- .../lib/parameters.tsp | 35 +-- .../src/common-types.ts | 7 +- .../src/rules/core-operations.ts | 2 +- .../test/rules/retry-after.test.ts | 1 + 9 files changed, 235 insertions(+), 105 deletions(-) create mode 100644 packages/typespec-azure-resource-manager/lib/common-types/internal.tsp diff --git a/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp index 2cf7e027fa..211ef3d5e5 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/common-types.tsp @@ -1,10 +1,12 @@ import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; import "./common-types.tsp"; import "./types-ref.tsp"; import "./managed-identity-ref.tsp"; import "./private-links-ref.tsp"; import "./customer-managed-keys-ref.tsp"; import "./extended-location-ref.tsp"; +import "./internal.tsp"; import "./commontypes.private.decorators.tsp"; using TypeSpec.Versioning; diff --git a/packages/typespec-azure-resource-manager/lib/common-types/internal.tsp b/packages/typespec-azure-resource-manager/lib/common-types/internal.tsp new file mode 100644 index 0000000000..d7d6eb7062 --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/common-types/internal.tsp @@ -0,0 +1,21 @@ +namespace Azure.ResourceManager.CommonTypes; + +/** + * An internal enum to indicate the resource support for various path types + */ +enum ResourceHome { + @doc("The resource is bound to a tenant") + Tenant, + + @doc("The resource is bound to a subscription") + Subscription, + + @doc("The resource is bound to a location") + Location, + + @doc("The resource is bound to a resource group") + ResourceGroup, + + @doc("The resource is bound to an extension") + Extension, +} diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp index 50ee81f61c..05effb58d6 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp @@ -2,88 +2,154 @@ import "../private.decorators.tsp"; import "./common-types.tsp"; import "./types.tsp"; -using Azure.ResourceManager.CommonTypes.Private; +using Azure.ResourceManager.CommonTypes.Private; -namespace Azure.ResourceManager.Foundations; +namespace Azure.ResourceManager.CommonTypes; /** Common resource fields that are returned in the response for all Azure Resource Manager resources. */ @@armCommonDefinition(Resource, "Resource", Azure.ResourceManager.CommonTypes.Versions.v3); @@armCommonDefinition(Resource, "Resource", Azure.ResourceManager.CommonTypes.Versions.v4); @@armCommonDefinition(Resource, "Resource", Azure.ResourceManager.CommonTypes.Versions.v5); - /** The resource model definition for an Azure Resource Manager resource with an etag. */ -@@armCommonDefinition(AzureEntityResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(AzureEntityResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(AzureEntityResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(AzureEntityResource, + "TrackedResource", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(AzureEntityResource, + "TrackedResource", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(AzureEntityResource, + "TrackedResource", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * The base tracked resource. */ -@@armCommonDefinition(TrackedResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(TrackedResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(TrackedResource, "TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(TrackedResource, + "TrackedResource", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(TrackedResource, + "TrackedResource", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(TrackedResource, + "TrackedResource", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * The base proxy resource. */ -@@armCommonDefinition(ProxyResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(ProxyResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(ProxyResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(ProxyResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(ProxyResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(ProxyResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * The base extension resource. */ -@@armCommonDefinition(ExtensionResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(ExtensionResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(ExtensionResource, "ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(ExtensionResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(ExtensionResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(ExtensionResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * The SKU (Stock Keeping Unit) assigned to this resource. */ - @@armCommonDefinition(Sku, "Sku", Azure.ResourceManager.CommonTypes.Versions.v3); @@armCommonDefinition(Sku, "Sku", Azure.ResourceManager.CommonTypes.Versions.v4); @@armCommonDefinition(Sku, "Sku", Azure.ResourceManager.CommonTypes.Versions.v5); - /** * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -@@armCommonDefinition(OperationListResult,"OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(OperationListResult,"OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(OperationListResult,"OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v5); - +@@armCommonDefinition(OperationListResult, + "OperationListResult", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(OperationListResult, + "OperationListResult", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(OperationListResult, + "OperationListResult", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * Details of a REST API operation, returned from the Resource Provider Operations API */ -@@armCommonDefinition(Operation,"Operation", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(Operation,"Operation", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(Operation,"Operation", Azure.ResourceManager.CommonTypes.Versions.v5); - +@@armCommonDefinition(Operation, "Operation", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(Operation, "Operation", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(Operation, "Operation", Azure.ResourceManager.CommonTypes.Versions.v5); /** * Localized display information for and operation. */ -@@armCommonDefinition(OperationDisplay, "OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(OperationDisplay, "OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(OperationDisplay, "OperationDisplay", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(OperationDisplay, + "OperationDisplay", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(OperationDisplay, + "OperationDisplay", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(OperationDisplay, + "OperationDisplay", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * The current status of an async operation. */ -@@armCommonDefinition(OperationStatusResult, "OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(OperationStatusResult, "OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(OperationStatusResult, "OperationStatusResult", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(OperationStatusResult, + "OperationStatusResult", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(OperationStatusResult, + "OperationStatusResult", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(OperationStatusResult, + "OperationStatusResult", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * The default operationId parameter type. */ -@@armCommonDefinition(OperationIdParameter, "OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(OperationIdParameter, "OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(OperationIdParameter, "OperationIdParameter", Azure.ResourceManager.CommonTypes.Versions.v5); - +@@armCommonDefinition(OperationIdParameter, + "OperationIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(OperationIdParameter, + "OperationIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(OperationIdParameter, + "OperationIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * The error detail. @@ -95,35 +161,87 @@ namespace Azure.ResourceManager.Foundations; /** * The resource management error additional info. */ -@@armCommonDefinition(ErrorAdditionalInfo, "ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(ErrorAdditionalInfo, "ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(ErrorAdditionalInfo, "ErrorAdditionalInfo", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(ErrorAdditionalInfo, + "ErrorAdditionalInfo", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(ErrorAdditionalInfo, + "ErrorAdditionalInfo", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(ErrorAdditionalInfo, + "ErrorAdditionalInfo", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * Metadata pertaining to creation and last modification of the resource. */ @@armCommonDefinition(SystemData, "systemData", Azure.ResourceManager.CommonTypes.Versions.v3); @@armCommonDefinition(SystemData, "systemData", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(SystemData,"systemData", Azure.ResourceManager.CommonTypes.Versions.v5); - +@@armCommonDefinition(SystemData, "systemData", Azure.ResourceManager.CommonTypes.Versions.v5); /** * Details of the resource plan. */ @@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v3); @@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(Plan,"Plan", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v5); /** * The check availability request body. */ -@@armCommonDefinition(CheckNameAvailabilityRequest, "CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(CheckNameAvailabilityRequest, "CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(CheckNameAvailabilityRequest, "CheckNameAvailabilityRequest", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(CheckNameAvailabilityRequest, + "CheckNameAvailabilityRequest", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(CheckNameAvailabilityRequest, + "CheckNameAvailabilityRequest", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(CheckNameAvailabilityRequest, + "CheckNameAvailabilityRequest", + Azure.ResourceManager.CommonTypes.Versions.v5 +); /** * The check availability result. */ -@@armCommonDefinition(CheckNameAvailabilityResponse, "CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v3); -@@armCommonDefinition(CheckNameAvailabilityResponse, "CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v4); -@@armCommonDefinition(CheckNameAvailabilityResponse, "CheckNameAvailabilityResponse", Azure.ResourceManager.CommonTypes.Versions.v5); +@@armCommonDefinition(CheckNameAvailabilityResponse, + "CheckNameAvailabilityResponse", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(CheckNameAvailabilityResponse, + "CheckNameAvailabilityResponse", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(CheckNameAvailabilityResponse, + "CheckNameAvailabilityResponse", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + +@@armCommonParameter(ApiVersionParameter.apiVersion, + "ApiVersionParameter", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonParameter(ApiVersionParameter.apiVersion, + "ApiVersionParameter", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonParameter(ApiVersionParameter.apiVersion, + "ApiVersionParameter", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + +@@armCommonParameter(SubscriptionIdParameter.subscriptionId, + "SubscriptionIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonParameter(SubscriptionIdParameter.subscriptionId, + "SubscriptionIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonParameter(SubscriptionIdParameter.subscriptionId, + "SubscriptionIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v5 +); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index ae353ac13f..6ab299e479 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -1,8 +1,10 @@ using TypeSpec.Http; +using TypeSpec.Rest; using TypeSpec.OpenAPI; using TypeSpec.Versioning; using Azure.Core; using Azure.ResourceManager.Private; +using Azure.ResourceManager.CommonTypes.Private; namespace Azure.ResourceManager.CommonTypes; @@ -417,3 +419,41 @@ union CheckNameAvailabilityReason { string, } + +/** + * The default api-version parameter type. + */ +@doc("The default api-version parameter type.") +model ApiVersionParameter { + @query("api-version") + @minLength(1) + @doc("The API version to use for this operation.") + @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v3) + @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v4) + @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v5) + @resourceParameterBaseFor( + [ + ResourceHome.ResourceGroup, + ResourceHome.Subscription, + ResourceHome.Location, + ResourceHome.Tenant, + ResourceHome.Extension + ] + ) + apiVersion: string; +} + +/** + * The default subscriptionId parameter type. + */ +@doc("The default subscriptionId parameter type.") +model SubscriptionIdParameter { + @path + @minLength(1) + @segment("subscriptions") + @doc("The ID of the target subscription.") + @resourceParameterBaseFor( + [ResourceHome.ResourceGroup, ResourceHome.Subscription, ResourceHome.Location] + ) + subscriptionId: string; +} diff --git a/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp b/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp index b79cada82f..a63cb25c74 100644 --- a/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp +++ b/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp @@ -16,26 +16,6 @@ using Azure.ResourceManager.Private; namespace Azure.ResourceManager.Foundations; -/** - * An internal enum to indicate the resource support for various path types - */ -enum ResourceHome { - @doc("The resource is bound to a tenant") - Tenant, - - @doc("The resource is bound to a subscription") - Subscription, - - @doc("The resource is bound to a location") - Location, - - @doc("The resource is bound to a resource group") - ResourceGroup, - - @doc("The resource is bound to an extension") - Extension, -} - /** * Base parameters for a resource. * diff --git a/packages/typespec-azure-resource-manager/lib/parameters.tsp b/packages/typespec-azure-resource-manager/lib/parameters.tsp index 1827ec6e90..5d614fb073 100644 --- a/packages/typespec-azure-resource-manager/lib/parameters.tsp +++ b/packages/typespec-azure-resource-manager/lib/parameters.tsp @@ -11,43 +11,12 @@ namespace Azure.ResourceManager; /** * The default api-version parameter type. */ -@doc("The default api-version parameter type.") -model ApiVersionParameter { - @query("api-version") - @minLength(1) - @doc("The API version to use for this operation.") - @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v3) - @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v4) - @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v5) - @resourceParameterBaseFor( - [ - ResourceHome.ResourceGroup, - ResourceHome.Subscription, - ResourceHome.Location, - ResourceHome.Tenant, - ResourceHome.Extension - ] - ) - apiVersion: string; -} +alias ApiVersionParameter = CommonTypes.ApiVersionParameter; /** * The default subscriptionId parameter type. */ -@doc("The default subscriptionId parameter type.") -model SubscriptionIdParameter { - @path - @minLength(1) - @segment("subscriptions") - @doc("The ID of the target subscription.") - @armCommonParameter("SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v3) - @armCommonParameter("SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v4) - @armCommonParameter("SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v5) - @resourceParameterBaseFor( - [ResourceHome.ResourceGroup, ResourceHome.Subscription, ResourceHome.Location] - ) - subscriptionId: string; -} +alias SubscriptionIdParameter = CommonTypes.SubscriptionIdParameter; /** * DEPRECATED - DO NOT USE diff --git a/packages/typespec-azure-resource-manager/src/common-types.ts b/packages/typespec-azure-resource-manager/src/common-types.ts index 3f2d23cfed..ae5affc8a6 100644 --- a/packages/typespec-azure-resource-manager/src/common-types.ts +++ b/packages/typespec-azure-resource-manager/src/common-types.ts @@ -3,7 +3,6 @@ import { Diagnostic, Enum, EnumMember, - EnumValue, Model, ModelProperty, Namespace, @@ -56,11 +55,11 @@ export function isArmCommonType(entity: Type): boolean { export function $armCommonTypesVersion( context: DecoratorContext, entity: Namespace | EnumMember, - version: EnumValue + version: EnumMember ) { - context.program.stateMap(ArmStateKeys.armCommonTypesVersion).set(entity, version.value.name); + context.program.stateMap(ArmStateKeys.armCommonTypesVersion).set(entity, version.name as string); - context.call($useDependency, entity, version.value); + context.call($useDependency, entity, version); } /** diff --git a/packages/typespec-azure-resource-manager/src/rules/core-operations.ts b/packages/typespec-azure-resource-manager/src/rules/core-operations.ts index 8d5da0574b..7bde58f7f0 100644 --- a/packages/typespec-azure-resource-manager/src/rules/core-operations.ts +++ b/packages/typespec-azure-resource-manager/src/rules/core-operations.ts @@ -90,7 +90,7 @@ function isApiParameter(program: Program, property: ModelProperty): boolean { if (sourceModel === undefined) return false; return ( sourceModel.name === "ApiVersionParameter" && - getNamespaceName(program, sourceModel) === "Azure.ResourceManager" + getNamespaceName(program, sourceModel) === "Azure.ResourceManager.CommonTypes" ); } diff --git a/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts b/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts index 0220cfe8b9..384be12b28 100644 --- a/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts @@ -26,6 +26,7 @@ describe("typespec-azure-resource-manager: retry-after rule", () => { ` @useDependency(Azure.Core.Versions.v1_0_Preview_2) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) @armProviderNamespace namespace Microsoft.Foo; From efb8a7df52d7a447e63f3d60976129bae7d0d8c9 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Thu, 30 May 2024 12:17:29 -0700 Subject: [PATCH 03/25] Clean regen-samples --- .../arm-library/ref-library/int-templates.tsp | 1 + .../arm-library/ref-library/op-templates.tsp | 1 + .../operations/operation-status/main.tsp | 2 +- .../lib/backcompat.tsp | 1 - .../lib/common-types/customer-managed-keys.tsp | 17 ----------------- .../lib/common-types/private-links.tsp | 10 ++++++++++ .../lib/models.tsp | 18 ++++++++++++++++++ 7 files changed, 31 insertions(+), 19 deletions(-) diff --git a/packages/samples/specs/resource-manager/arm-library/ref-library/int-templates.tsp b/packages/samples/specs/resource-manager/arm-library/ref-library/int-templates.tsp index 8e59e40e18..48b7755e1a 100644 --- a/packages/samples/specs/resource-manager/arm-library/ref-library/int-templates.tsp +++ b/packages/samples/specs/resource-manager/arm-library/ref-library/int-templates.tsp @@ -11,6 +11,7 @@ using Azure.ResourceManager; #suppress "@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint" "cuz" @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@useDependency(Azure.ResourceManager.CommonTypes.Versions.v3) @armLibraryNamespace namespace Microsoft.InterfacesTest; diff --git a/packages/samples/specs/resource-manager/arm-library/ref-library/op-templates.tsp b/packages/samples/specs/resource-manager/arm-library/ref-library/op-templates.tsp index 4106ef2383..63c4ce47eb 100644 --- a/packages/samples/specs/resource-manager/arm-library/ref-library/op-templates.tsp +++ b/packages/samples/specs/resource-manager/arm-library/ref-library/op-templates.tsp @@ -11,6 +11,7 @@ using Azure.ResourceManager; #suppress "@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint" "cuz" @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@useDependency(Azure.ResourceManager.CommonTypes.Versions.v3) @armLibraryNamespace namespace Microsoft.OperationsTest; diff --git a/packages/samples/specs/resource-manager/operations/operation-status/main.tsp b/packages/samples/specs/resource-manager/operations/operation-status/main.tsp index 62e829a52c..25a7b0d1b9 100644 --- a/packages/samples/specs/resource-manager/operations/operation-status/main.tsp +++ b/packages/samples/specs/resource-manager/operations/operation-status/main.tsp @@ -19,7 +19,7 @@ namespace Microsoft.OperationStatusSample; enum Versions { @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @armCommonTypesVersion("v5") + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) `2022-11-01-preview`, } diff --git a/packages/typespec-azure-resource-manager/lib/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/backcompat.tsp index 720481de46..9612fff99e 100644 --- a/packages/typespec-azure-resource-manager/lib/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/backcompat.tsp @@ -7,7 +7,6 @@ namespace Azure.ResourceManager { alias KeyEncryptionKeyIdentity = CommonTypes.KeyEncryptionKeyIdentity; alias CustomerManagedKeyEncryption = CommonTypes.CustomerManagedKeyEncryption; alias EncryptionConfiguration = CommonTypes.EncryptionConfiguration; - alias Encryption = CommonTypes.Encryption; // private-links alias PrivateEndpoint = CommonTypes.PrivateEndpoint; diff --git a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp index 1bcca19489..dc7f66a372 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp @@ -65,20 +65,3 @@ model EncryptionConfiguration { /** key encryption key Url, versioned or unversioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. */ keyEncryptionKeyUrl?: string; } - -/** - * Model used only to spread in the `encryption` envelope property for a resource. - * @example - * - * ```typespec - * model Foo is TrackedResource { - * ...Encryption; - * } - * ``` - */ -/** All encryption configuration for a resource. */ -@added(CommonTypes.Versions.v4) -model Encryption { - /** All encryption configuration for a resource. */ - encryption: EncryptionConfiguration; -} diff --git a/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp b/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp index ac2d022505..6f2c20c664 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp @@ -86,6 +86,16 @@ union PrivateEndpointServiceConnectionStatus { model PrivateEndpointConnectionParameter { /** The name of the private endpoint connection associated with the Azure resource. */ @path + @CommonTypes.Private.armCommonParameter( + "PrivateEndpointConnectionName", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "privatelinks.json" + ) + @CommonTypes.Private.armCommonParameter( + "PrivateEndpointConnectionName", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" + ) @TypeSpec.Rest.segment(Segment) @key("privateEndpointConnectionName") name: string; diff --git a/packages/typespec-azure-resource-manager/lib/models.tsp b/packages/typespec-azure-resource-manager/lib/models.tsp index 2e0c586f70..1a39da1daa 100644 --- a/packages/typespec-azure-resource-manager/lib/models.tsp +++ b/packages/typespec-azure-resource-manager/lib/models.tsp @@ -381,4 +381,22 @@ model ManagedByProperty { managedBy?: string; } +/** Please use the spread model EncryptionProperty */ +alias Encryption = EncryptionProperty; +/** + * Model used only to spread in the `encryption` envelope property for a resource. + * @example + * + * ```typespec + * model Foo is TrackedResource { + * ...Encryption; + * } + * ``` + */ +/** All encryption configuration for a resource. */ +model EncryptionProperty { + /** All encryption configuration for a resource. */ + encryption: EncryptionConfiguration; +} + //#endregion From 00d86e09f1e939324020bff796f7eb2a3dc6c95c Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 31 May 2024 01:12:59 -0700 Subject: [PATCH 04/25] Only few rule tests failing --- .../lib/common-types/extended-location.tsp | 32 ++++++++--------- .../lib/common-types/managed-identity-ref.tsp | 24 +++++-------- .../lib/common-types/private-links-ref.tsp | 26 +++++--------- .../lib/common-types/types.tsp | 3 -- .../lib/foundations/backcompat.tsp | 2 -- .../src/common-types.ts | 8 +++++ .../src/namespace.ts | 17 +++++++++ .../arm-common-types-registration.test.ts | 24 ++++++------- .../test/enforce-constraint.test.ts | 14 ++++---- .../rules/arm-common-types-version.test.ts | 36 ------------------- .../test/rules/arm-resource-interface.test.ts | 5 +-- 11 files changed, 77 insertions(+), 114 deletions(-) diff --git a/packages/typespec-azure-resource-manager/lib/common-types/extended-location.tsp b/packages/typespec-azure-resource-manager/lib/common-types/extended-location.tsp index 37ddd438e4..3ff52b38aa 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/extended-location.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/extended-location.tsp @@ -1,22 +1,20 @@ - namespace Azure.ResourceManager.CommonTypes; - /** The complex type of the extended location. */ - model ExtendedLocation { - /** The name of the extended location. */ - name: string; - - /** The type of the extended location. */ - type: ExtendedLocationType; - } +/** The complex type of the extended location. */ +model ExtendedLocation { + /** The name of the extended location. */ + name: string; - /** The supported ExtendedLocation types. */ - union ExtendedLocationType { - /** Azure Edge Zones location type */ - EdgeZone: "EdgeZone", + /** The type of the extended location. */ + type: ExtendedLocationType; +} - /** Azure Custom Locations type */ - CustomLocation: "CustomLocation", +/** The supported ExtendedLocation types. */ +union ExtendedLocationType { + /** Azure Edge Zones location type */ + EdgeZone: "EdgeZone", - string, - } + /** Azure Custom Locations type */ + CustomLocation: "CustomLocation", + string, +} diff --git a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp index 51933e44b7..c32751ba18 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp @@ -7,28 +7,24 @@ namespace Azure.ResourceManager.CommonTypes; /** * The properties of the managed service identities assigned to this resource. */ -@@armCommonDefinition( - ManagedServiceIdentity, +@@armCommonDefinition(ManagedServiceIdentity, "ManagedServiceIdentity", #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "managedidentity.json" ); -@@armCommonDefinition( - ManagedServiceIdentity, +@@armCommonDefinition(ManagedServiceIdentity, "ManagedServiceIdentity", Azure.ResourceManager.CommonTypes.Versions.v5, "managedidentity.json" ); /** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", */ -@@armCommonDefinition( - UserAssignedIdentities, +@@armCommonDefinition(UserAssignedIdentities, "UserAssignedIdentities", #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "managedidentity.json" ); -@@armCommonDefinition( - UserAssignedIdentities, +@@armCommonDefinition(UserAssignedIdentities, "UserAssignedIdentities", Azure.ResourceManager.CommonTypes.Versions.v5, "managedidentity.json" @@ -37,14 +33,12 @@ namespace Azure.ResourceManager.CommonTypes; /** * The properties of the service-assigned identity associated with this resource. */ -@@armCommonDefinition( - SystemAssignedServiceIdentity, +@@armCommonDefinition(SystemAssignedServiceIdentity, "SystemAssignedServiceIdentity", #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "managedidentity.json" ); -@@armCommonDefinition( - SystemAssignedServiceIdentity, +@@armCommonDefinition(SystemAssignedServiceIdentity, "SystemAssignedServiceIdentity", Azure.ResourceManager.CommonTypes.Versions.v5, "managedidentity.json" @@ -53,14 +47,12 @@ namespace Azure.ResourceManager.CommonTypes; /** * A managed identity assigned by the user. */ -@@armCommonDefinition( - UserAssignedIdentity, +@@armCommonDefinition(UserAssignedIdentity, "UserAssignedIdentity", #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "managedidentity.json" ); -@@armCommonDefinition( - UserAssignedIdentity, +@@armCommonDefinition(UserAssignedIdentity, "UserAssignedIdentity", Azure.ResourceManager.CommonTypes.Versions.v5, "managedidentity.json" diff --git a/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp index dca2081e36..940538087f 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp @@ -5,43 +5,36 @@ using Azure.ResourceManager.CommonTypes.Private; namespace Azure.ResourceManager.CommonTypes; /** The private endpoint resource */ -@@armCommonDefinition( - PrivateEndpoint, +@@armCommonDefinition(PrivateEndpoint, "PrivateEndpoint", #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "privatelinks.json" ); -@@armCommonDefinition( - PrivateEndpoint, +@@armCommonDefinition(PrivateEndpoint, "PrivateEndpoint", Azure.ResourceManager.CommonTypes.Versions.v5, "privatelinks.json" ); - /** Properties of he private endpoint connection resource */ -@@armCommonDefinition( - PrivateEndpointConnectionProperties, +@@armCommonDefinition(PrivateEndpointConnectionProperties, "PrivateEndpointConnectionProperties", #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "privatelinks.json" ); -@@armCommonDefinition( - PrivateEndpointConnectionProperties, +@@armCommonDefinition(PrivateEndpointConnectionProperties, "PrivateEndpointConnectionProperties", Azure.ResourceManager.CommonTypes.Versions.v5, "privatelinks.json" ); /** A collection of information about the state of the connection between service consumer and provider. */ -@@armCommonDefinition( - PrivateLinkServiceConnectionState, +@@armCommonDefinition(PrivateLinkServiceConnectionState, "PrivateLinkServiceConnectionState", #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "privatelinks.json" ); -@@armCommonDefinition( - PrivateLinkServiceConnectionState, +@@armCommonDefinition(PrivateLinkServiceConnectionState, "PrivateLinkServiceConnectionState", Azure.ResourceManager.CommonTypes.Versions.v5, "privatelinks.json" @@ -49,16 +42,13 @@ namespace Azure.ResourceManager.CommonTypes; /** Properties of a private link resource. */ #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Matches current common code" -@@armCommonDefinition( - PrivateLinkResourceProperties, +@@armCommonDefinition(PrivateLinkResourceProperties, "PrivateLinkResourceProperties", #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "privatelinks.json" ); -@@armCommonDefinition( - PrivateLinkResourceProperties, +@@armCommonDefinition(PrivateLinkResourceProperties, "PrivateLinkResourceProperties", Azure.ResourceManager.CommonTypes.Versions.v5, "privatelinks.json" ); - diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 6ab299e479..6f9ed8e323 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -428,9 +428,6 @@ model ApiVersionParameter { @query("api-version") @minLength(1) @doc("The API version to use for this operation.") - @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v3) - @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v4) - @armCommonParameter("ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v5) @resourceParameterBaseFor( [ ResourceHome.ResourceGroup, diff --git a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp index 41c61bcc4a..e435f51f7c 100644 --- a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp @@ -1,5 +1,3 @@ -using Azure.ResourceManager.CommonTypes; - namespace Azure.ResourceManager.Foundations { // extended-location alias ExtendedLocation = CommonTypes.ExtendedLocation; diff --git a/packages/typespec-azure-resource-manager/src/common-types.ts b/packages/typespec-azure-resource-manager/src/common-types.ts index ae5affc8a6..2b86a05134 100644 --- a/packages/typespec-azure-resource-manager/src/common-types.ts +++ b/packages/typespec-azure-resource-manager/src/common-types.ts @@ -59,6 +59,14 @@ export function $armCommonTypesVersion( ) { context.program.stateMap(ArmStateKeys.armCommonTypesVersion).set(entity, version.name as string); + if (entity.kind === "Namespace") { + const versioned = entity.decorators.find((x) => x.definition?.name === "@versioned"); + // If it is versioned namespace, we will skip adding @useDependency to namespace + if (versioned) { + return; + } + } + // Add @useDependency on version enum members or on unversioned namespace context.call($useDependency, entity, version); } diff --git a/packages/typespec-azure-resource-manager/src/namespace.ts b/packages/typespec-azure-resource-manager/src/namespace.ts index f8a44002d7..a4e646cd3b 100644 --- a/packages/typespec-azure-resource-manager/src/namespace.ts +++ b/packages/typespec-azure-resource-manager/src/namespace.ts @@ -1,6 +1,7 @@ import { __unsupported_enable_checkStandardOperations } from "@azure-tools/typespec-azure-core"; import { DecoratorContext, + EnumMember, Model, ModelProperty, Namespace, @@ -12,6 +13,7 @@ import { import * as http from "@typespec/http"; import { getAuthentication, setAuthentication, setRouteOptionsForNamespace } from "@typespec/http"; import { getResourceTypeForKeyParam } from "@typespec/rest"; +import { $armCommonTypesVersion } from "./common-types.js"; import { reportDiagnostic } from "./lib.js"; import { getSingletonResourceKey } from "./resource.js"; import { ArmStateKeys } from "./state.js"; @@ -128,6 +130,21 @@ export function $armProviderNamespace( } } + // Determine whether to set a default ARM CommonTypes.Version + const v3EnumMember = context.program.resolveTypeReference( + "Azure.ResourceManager.CommonTypes.Versions.v3" + )[0] as EnumMember; + if (v3EnumMember) { + const armCommonTypesVersion = entity.decorators.find( + (x) => x.definition?.name === "@armCommonTypesVersion" + ); + // if no existing @armCommonTypesVersion decorator, add default. + // This will NOT cause error if overrode on version enum. + if (!armCommonTypesVersion) { + context.call($armCommonTypesVersion, entity, v3EnumMember); + } + } + // 'namespace' is optional, use the actual namespace string if omitted const typespecNamespace = getNamespaceFullName(entity); if (!armProviderNamespace) { diff --git a/packages/typespec-azure-resource-manager/test/arm-common-types-registration.test.ts b/packages/typespec-azure-resource-manager/test/arm-common-types-registration.test.ts index e9588245e7..bb365e7367 100644 --- a/packages/typespec-azure-resource-manager/test/arm-common-types-registration.test.ts +++ b/packages/typespec-azure-resource-manager/test/arm-common-types-registration.test.ts @@ -44,9 +44,9 @@ describe("common definition", () => { it.each(["v3", "v4", "v5"])("link to %s", async (version) => { const [ref, diagnostics] = await compute( ` - @Azure.ResourceManager.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v3, "foo.json") - @Azure.ResourceManager.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v4, "foo.json") - @Azure.ResourceManager.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v3, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v4, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") `, version ); @@ -63,8 +63,8 @@ describe("common definition", () => { describe("type added in v4", () => { const decorators = ` - @Azure.ResourceManager.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v4, "foo.json") - @Azure.ResourceManager.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v4, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") `; it.each(["v3"])("using in %s emits diagnostics", async () => { const [_, diagnostics] = await compute(decorators, "v3"); @@ -89,7 +89,7 @@ describe("common definition", () => { describe("type added in v5", () => { const decorators = ` - @Azure.ResourceManager.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonDefinition("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") `; it.each(["v3", "v4"])("using in %s emits diagnostics", async () => { const [_, diagnostics] = await compute(decorators, "v3"); @@ -137,9 +137,9 @@ describe("common parameters", () => { it.each(["v3", "v4", "v5"])("using %s link to version", async (version) => { const [ref, diagnostics] = await compute( ` - @Azure.ResourceManager.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v3, "foo.json") - @Azure.ResourceManager.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v4, "foo.json") - @Azure.ResourceManager.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v3, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v4, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") `, version ); @@ -156,8 +156,8 @@ describe("common parameters", () => { describe("type added in v4", () => { const decorators = ` - @Azure.ResourceManager.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v4, "foo.json") - @Azure.ResourceManager.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v4, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") `; it.each(["v3"])("using in %s emits diagnostics", async () => { const [_, diagnostics] = await compute(decorators, "v3"); @@ -182,7 +182,7 @@ describe("common parameters", () => { describe("type added in v5", () => { const decorators = ` - @Azure.ResourceManager.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") + @Azure.ResourceManager.CommonTypes.Private.armCommonParameter("Foo", Azure.ResourceManager.CommonTypes.Versions.v5, "foo.json") `; it.each(["v3", "v4"])("using in %s emits diagnostics", async () => { const [_, diagnostics] = await compute(decorators, "v3"); diff --git a/packages/typespec-azure-resource-manager/test/enforce-constraint.test.ts b/packages/typespec-azure-resource-manager/test/enforce-constraint.test.ts index b89efdebab..a7267c1af1 100644 --- a/packages/typespec-azure-resource-manager/test/enforce-constraint.test.ts +++ b/packages/typespec-azure-resource-manager/test/enforce-constraint.test.ts @@ -73,20 +73,18 @@ describe("typespec-azure-resource-manager: @enforceConstraint", () => { `); expectDiagnostics(diagnostics, [ { - code: "@azure-tools/typespec-azure-resource-manager/template-type-constraint-no-met", - message: `The template parameter "Widget" for "ArmResourceCreateOrReplaceSync" does not extend the constraint type "Resource". Please use the "TrackedResource", "ProxyResource", or "ExtensionResource" template to define the resource.`, - }, - { - code: "@azure-tools/typespec-azure-resource-manager/template-type-constraint-no-met", - message: `The template parameter "Widget" for "create" does not extend the constraint type "Resource". Please use the "TrackedResource", "ProxyResource", or "ExtensionResource" template to define the resource.`, + code: "invalid-argument", + message: `Argument of type 'Microsoft.Contoso.Widget' is not assignable to parameter of type 'Azure.ResourceManager.CommonTypes.Resource'`, }, { code: "@azure-tools/typespec-azure-resource-manager/template-type-constraint-no-met", - message: `The template parameter "CustomResource" for "ArmResourceCreateOrReplaceSync" does not extend the constraint type "Resource". Please use the "TrackedResource", "ProxyResource", or "ExtensionResource" template to define the resource.`, + message: + 'The template parameter "CustomResource" for "ArmResourceCreateOrReplaceSync" does not extend the constraint type "Resource". Please use the "TrackedResource", "ProxyResource", or "ExtensionResource" template to define the resource.', }, { code: "@azure-tools/typespec-azure-resource-manager/template-type-constraint-no-met", - message: `The template parameter "CustomResource" for "delete" does not extend the constraint type "Resource". Please use the "TrackedResource", "ProxyResource", or "ExtensionResource" template to define the resource.`, + message: + 'The template parameter "CustomResource" for "delete" does not extend the constraint type "Resource". Please use the "TrackedResource", "ProxyResource", or "ExtensionResource" template to define the resource.', }, ]); }); diff --git a/packages/typespec-azure-resource-manager/test/rules/arm-common-types-version.test.ts b/packages/typespec-azure-resource-manager/test/rules/arm-common-types-version.test.ts index 745d981329..c8ea033143 100644 --- a/packages/typespec-azure-resource-manager/test/rules/arm-common-types-version.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/arm-common-types-version.test.ts @@ -20,42 +20,6 @@ describe("typespec-azure-resource-manager: ARM common-types version rule", () => ); }); - it("emits diagnostic when a version in the enum is missing a common type version", async () => { - await tester - .expect( - ` - @service({ title: "Test" }) - @versioned(Service.Versions) - @armProviderNamespace("Contoso.Service") - namespace Service; - - enum Versions { - v1; - - @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) - v2; - } - ` - ) - .toEmitDiagnostics({ - code: "@azure-tools/typespec-azure-resource-manager/arm-common-types-version", - }); - }); - - it("emits diagnostic when unversioned service namespace is missing a common type version", async () => { - await tester - .expect( - ` - @service({ title: "Test" }) - @armProviderNamespace("Contoso.Service") - namespace Service; - ` - ) - .toEmitDiagnostics({ - code: "@azure-tools/typespec-azure-resource-manager/arm-common-types-version", - }); - }); - it("does not emit when the service namespace has a common type version without version on enum values", async () => { await tester .expect( diff --git a/packages/typespec-azure-resource-manager/test/rules/arm-resource-interface.test.ts b/packages/typespec-azure-resource-manager/test/rules/arm-resource-interface.test.ts index 93bdd46d2f..b4673aaf93 100644 --- a/packages/typespec-azure-resource-manager/test/rules/arm-resource-interface.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/arm-resource-interface.test.ts @@ -72,8 +72,9 @@ describe("typespec-azure-resource-manager: detect non-post actions", () => { ` ) .toEmitDiagnostics({ - code: "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator", - message: "Each resource interface must have an @armResourceOperations decorator.", + code: "@typespec/versioning/using-versioned-library", + message: + "Namespace 'Microsoft.Foo' is referencing types from versioned namespace 'Azure.ResourceManager.CommonTypes' but didn't specify which versions with @useDependency.", }); }); }); From 2687b08d8e02320d165aaa05df82172ac8382e74 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 31 May 2024 18:37:01 -0700 Subject: [PATCH 05/25] All ARM tests passing --- .../test/rules/arm-resource-interface.test.ts | 7 +++-- .../test/rules/core-operations.test.ts | 4 +++ .../test/rules/operation-usage.test.ts | 2 ++ .../test/rules/patch-operations.test.ts | 4 +++ .../test/rules/retry-after.test.ts | 30 +++++++++++++------ 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/packages/typespec-azure-resource-manager/test/rules/arm-resource-interface.test.ts b/packages/typespec-azure-resource-manager/test/rules/arm-resource-interface.test.ts index b4673aaf93..b6e31b5842 100644 --- a/packages/typespec-azure-resource-manager/test/rules/arm-resource-interface.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/arm-resource-interface.test.ts @@ -32,9 +32,11 @@ describe("typespec-azure-resource-manager: detect non-post actions", () => { enum Versions { @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) v2021_09_21: "2022-09-21-preview", @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) v2022_01_10: "2022-01-10-alpha.1" } @@ -72,9 +74,8 @@ describe("typespec-azure-resource-manager: detect non-post actions", () => { ` ) .toEmitDiagnostics({ - code: "@typespec/versioning/using-versioned-library", - message: - "Namespace 'Microsoft.Foo' is referencing types from versioned namespace 'Azure.ResourceManager.CommonTypes' but didn't specify which versions with @useDependency.", + code: "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator", + message: "Each resource interface must have an @armResourceOperations decorator.", }); }); }); diff --git a/packages/typespec-azure-resource-manager/test/rules/core-operations.test.ts b/packages/typespec-azure-resource-manager/test/rules/core-operations.test.ts index c76fa3904a..20671f85fe 100644 --- a/packages/typespec-azure-resource-manager/test/rules/core-operations.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/core-operations.test.ts @@ -83,9 +83,11 @@ describe("typespec-azure-resource-manager: core operations rule", () => { enum Versions { @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) v2021_09_21: "2022-09-21-preview", @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) v2022_01_10: "2022-01-10-alpha.1" } @@ -147,9 +149,11 @@ describe("typespec-azure-resource-manager: core operations rule", () => { enum Versions { @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) v2021_09_21: "2022-09-21-preview", @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) v2022_01_10: "2022-01-10-alpha.1" } diff --git a/packages/typespec-azure-resource-manager/test/rules/operation-usage.test.ts b/packages/typespec-azure-resource-manager/test/rules/operation-usage.test.ts index b15b677562..94e2b592ec 100644 --- a/packages/typespec-azure-resource-manager/test/rules/operation-usage.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/operation-usage.test.ts @@ -36,9 +36,11 @@ describe("typespec-azure-resource-manager: detect non-post actions", () => { enum Versions { @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) v2021_09_21: "2022-09-21-preview", @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) v2022_01_10: "2022-01-10-alpha.1" } diff --git a/packages/typespec-azure-resource-manager/test/rules/patch-operations.test.ts b/packages/typespec-azure-resource-manager/test/rules/patch-operations.test.ts index 72bf418487..c8fbf35197 100644 --- a/packages/typespec-azure-resource-manager/test/rules/patch-operations.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/patch-operations.test.ts @@ -33,9 +33,11 @@ describe("typespec-azure-resource-manager: core operations rule", () => { enum Versions { @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) v2021_09_21: "2022-09-21-preview", @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) v2022_01_10: "2022-01-10-alpha.1" } @@ -106,9 +108,11 @@ describe("typespec-azure-resource-manager: core operations rule", () => { enum Versions { @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) v2021_09_21: "2022-09-21-preview", @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) v2022_01_10: "2022-01-10-alpha.1" } diff --git a/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts b/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts index 384be12b28..af9959e975 100644 --- a/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts @@ -24,28 +24,40 @@ describe("typespec-azure-resource-manager: retry-after rule", () => { await tester .expect( ` - @useDependency(Azure.Core.Versions.v1_0_Preview_2) - @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) - @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) + @service({ + title: "Microsoft.Foo", + }) @armProviderNamespace + @versioned(Versions) namespace Microsoft.Foo; - + + /** Contoso API versions */ + enum Versions { + /** 2021-10-01-preview version */ + @useDependency(Azure.Core.Versions.v1_0_Preview_2) + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) + "2021-10-01-preview", + } + model FooResource is TrackedResource<{}> { - @key("foo") @segment("foo") @path + @key("foo") + @segment("foo") + @path name: string; } - + model UpdateFooResponse { @header("Retry-After") retryAfter: utcDateTime; ...FooResource; } - + @armResourceOperations interface FooResources { @armResourceUpdate(FooResource) @OpenAPI.extension("x-ms-long-running-operation", true) - @patch - op update(): UpdateFooResponse; + @patch + update(): UpdateFooResponse; } ` ) From b38580e7873d565f24b5fcb0a7cad22a28f9245d Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 31 May 2024 18:40:54 -0700 Subject: [PATCH 06/25] Update documentation --- .../azhang_ArmReorg-2024-4-31-18-40-39.md | 7 + .../reference/data-types.md | 1124 +++++++++-------- .../reference/decorators.md | 8 +- .../reference/index.mdx | 71 +- .../reference/interfaces.md | 2 +- .../typespec-azure-resource-manager/README.md | 8 +- 6 files changed, 627 insertions(+), 593 deletions(-) create mode 100644 .chronus/changes/azhang_ArmReorg-2024-4-31-18-40-39.md diff --git a/.chronus/changes/azhang_ArmReorg-2024-4-31-18-40-39.md b/.chronus/changes/azhang_ArmReorg-2024-4-31-18-40-39.md new file mode 100644 index 0000000000..958652c9f0 --- /dev/null +++ b/.chronus/changes/azhang_ArmReorg-2024-4-31-18-40-39.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-azure-resource-manager" +--- + +Reorganize ARM library internal models into fully version controlled `Azure.ResourceManager.CommontTypes` namespace. \ No newline at end of file diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index 69cc707f99..64361d4daf 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -8,20 +8,6 @@ toc_max_heading_level: 3 ## Azure.ResourceManager -### `ApiVersionParameter` {#Azure.ResourceManager.ApiVersionParameter} - -The default api-version parameter type. - -```typespec -model Azure.ResourceManager.ApiVersionParameter -``` - -#### Properties - -| Name | Type | Description | -| ---------- | -------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | - ### `ArmAcceptedLroResponse` {#Azure.ResourceManager.ArmAcceptedLroResponse} ```typespec @@ -272,7 +258,7 @@ model Azure.ResourceManager.ArmOperationStatus | startTime? | `utcDateTime` | Operation start time | | endTime? | `utcDateTime` | Operation complete time | | percentComplete? | `float64` | The progress made toward completing the operation | -| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.Foundations.ErrorDetail) | Errors that occurred if the operation ended with Canceled or Failed status | +| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) | Errors that occurred if the operation ended with Canceled or Failed status | ### `ArmResourceCreatedResponse` {#Azure.ResourceManager.ArmResourceCreatedResponse} @@ -377,23 +363,6 @@ model Azure.ResourceManager.ArmResponse | statusCode | `200` | The status code. | | body | `ResponseBody` | | -### `CustomerManagedKeyEncryption` {#Azure.ResourceManager.CustomerManagedKeyEncryption} - -Customer-managed key encryption properties for the resource. - -```typespec -model Azure.ResourceManager.CustomerManagedKeyEncryption -``` - -#### Properties - -| Name | Type | Description | -| ------------------------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| keyEncryptionKeyIdentity? | [`KeyEncryptionKeyIdentity`](./data-types.md#Azure.ResourceManager.KeyEncryptionKeyIdentity) | The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. | -| userAssignedIdentityResourceId? | `Core.armResourceIdentifier` | User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. | -| federatedClientId? | `Core.uuid` | application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540 | -| delegatedIdentityClientId? | `Core.uuid` | delegated identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity and userAssignedIdentity - internal use only. | - ### `DefaultProvisioningStateProperty` {#Azure.ResourceManager.DefaultProvisioningStateProperty} Standard resource provisioning state model. If you do not have any custom provisioning state, @@ -418,12 +387,13 @@ model FooProperties { | ------------------ | ---------------------------------------------------------------------------------------------- | --------------------------------------- | | provisioningState? | [`ResourceProvisioningState`](./data-types.md#Azure.ResourceManager.ResourceProvisioningState) | The provisioning state of the resource. | -### `Encryption` {#Azure.ResourceManager.Encryption} +### `EncryptionProperty` {#Azure.ResourceManager.EncryptionProperty} Model used only to spread in the `encryption` envelope property for a resource. +All encryption configuration for a resource. ```typespec -model Azure.ResourceManager.Encryption +model Azure.ResourceManager.EncryptionProperty ``` #### Examples @@ -436,25 +406,9 @@ model Foo is TrackedResource { #### Properties -| Name | Type | Description | -| ---------- | ------------------------------------------------------------------------------------------ | -------------------------------------------- | -| encryption | [`EncryptionConfiguration`](./data-types.md#Azure.ResourceManager.EncryptionConfiguration) | All encryption configuration for a resource. | - -### `EncryptionConfiguration` {#Azure.ResourceManager.EncryptionConfiguration} - -All encryption configuration for a resource. - -```typespec -model Azure.ResourceManager.EncryptionConfiguration -``` - -#### Properties - -| Name | Type | Description | -| ----------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| infrastructureEncryption? | [`InfrastructureEncryption`](./data-types.md#Azure.ResourceManager.InfrastructureEncryption) | Indicates if infrastructure encryption is enabled or disabled. | -| customerManagedKeyEncryption? | [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CustomerManagedKeyEncryption) | All customer-managed key encryption properties for the resource. | -| keyEncryptionKeyUrl? | `string` | key encryption key Url, versioned or unversioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. | +| Name | Type | Description | +| ---------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------- | +| encryption | [`EncryptionConfiguration`](./data-types.md#Azure.ResourceManager.CommonTypes.EncryptionConfiguration) | All encryption configuration for a resource. | ### `EntityTagProperty` {#Azure.ResourceManager.EntityTagProperty} @@ -491,7 +445,7 @@ model Azure.ResourceManager.ErrorResponse | Name | Type | Description | | ------ | ------------------------------------------------------------------------------ | ----------------- | -| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.Foundations.ErrorDetail) | The error object. | +| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) | The error object. | ### `ExtendedLocationProperty` {#Azure.ResourceManager.ExtendedLocationProperty} @@ -515,7 +469,7 @@ model Employee is TrackedResource { | Name | Type | Description | | ----------------- | ---------------------------------------------------------------------------------------- | ----------- | -| extendedLocation? | [`ExtendedLocation`](./data-types.md#Azure.ResourceManager.Foundations.ExtendedLocation) | | +| extendedLocation? | [`ExtendedLocation`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtendedLocation) | | ### `ExtensionResource` {#Azure.ResourceManager.ExtensionResource} @@ -632,7 +586,7 @@ model Foo is TrackedResource { | Name | Type | Description | | --------- | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | -| identity? | [`ManagedServiceIdentity`](./data-types.md#Azure.ResourceManager.Foundations.ManagedServiceIdentity) | The managed service identities assigned to this resource. | +| identity? | [`ManagedServiceIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity) | The managed service identities assigned to this resource. | ### `ManagedSystemAssignedIdentityProperty` {#Azure.ResourceManager.ManagedSystemAssignedIdentityProperty} @@ -657,7 +611,7 @@ model Foo is TrackedResource { | Name | Type | Description | | --------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------- | -| identity? | [`SystemAssignedServiceIdentity`](./data-types.md#Azure.ResourceManager.Foundations.SystemAssignedServiceIdentity) | The managed service identities assigned to this resource. | +| identity? | [`SystemAssignedServiceIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity) | The managed service identities assigned to this resource. | ### `ParentKeysOf` {#Azure.ResourceManager.ParentKeysOf} @@ -677,71 +631,6 @@ model Azure.ResourceManager.ParentKeysOf None -### `PrivateEndpoint` {#Azure.ResourceManager.PrivateEndpoint} - -The private endpoint resource - -```typespec -model Azure.ResourceManager.PrivateEndpoint -``` - -#### Properties - -| Name | Type | Description | -| ---- | ---------------------------- | -------------------------------------------- | -| id? | `Core.armResourceIdentifier` | The resource identifier for private endpoint | - -### `PrivateEndpointConnection` {#Azure.ResourceManager.PrivateEndpointConnection} - -The private endpoint connection resource - -```typespec -model Azure.ResourceManager.PrivateEndpointConnection -``` - -#### Properties - -| Name | Type | Description | -| ----------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------ | -| properties? | [`PrivateEndpointConnectionProperties`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnectionProperties) | The private endpoint connection properties | - -### `PrivateEndpointConnectionParameter` {#Azure.ResourceManager.PrivateEndpointConnectionParameter} - -The name of the private endpoint connection associated with the Azure resource. - -```typespec -model Azure.ResourceManager.PrivateEndpointConnectionParameter -``` - -#### Template Parameters - -| Name | Description | -| ------- | ----------------------------------------------------------------------------------------------- | -| Segment | The resource type name for private endpoint connections (default is privateEndpointConnections) | - -#### Properties - -| Name | Type | Description | -| ---- | -------- | ------------------------------------------------------------------------------- | -| name | `string` | The name of the private endpoint connection associated with the Azure resource. | - -### `PrivateEndpointConnectionProperties` {#Azure.ResourceManager.PrivateEndpointConnectionProperties} - -Properties of he private endpoint connection resource - -```typespec -model Azure.ResourceManager.PrivateEndpointConnectionProperties -``` - -#### Properties - -| Name | Type | Description | -| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| groupIds? | `string[]` | The group identifiers for the private endpoint resource | -| privateEndpoint? | [`PrivateEndpoint`](./data-types.md#Azure.ResourceManager.PrivateEndpoint) | The private endpoint resource | -| privateLinkServiceConnectionState | [`PrivateLinkServiceConnectionState`](./data-types.md#Azure.ResourceManager.PrivateLinkServiceConnectionState) | A collection of information about the state of the connection between service consumer and provider. | -| provisioningState? | [`PrivateEndpointConnectionProvisioningState`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnectionProvisioningState) | The provisioning state of the private endpoint connection resource. | - ### `PrivateEndpointConnectionResourceListResult` {#Azure.ResourceManager.PrivateEndpointConnectionResourceListResult} List of private endpoint connections associated with the specified resource. @@ -752,9 +641,9 @@ model Azure.ResourceManager.PrivateEndpointConnectionResourceListResult #### Properties -| Name | Type | Description | -| ------ | --------------------------------------------- | ------------------------------------- | -| value? | `ResourceManager.PrivateEndpointConnection[]` | Array of private endpoint connections | +| Name | Type | Description | +| ------ | --------------------------------------------------------- | ------------------------------------- | +| value? | `ResourceManager.CommonTypes.PrivateEndpointConnection[]` | Array of private endpoint connections | ### `PrivateLinkResource` {#Azure.ResourceManager.PrivateLinkResource} @@ -782,26 +671,6 @@ model Azure.ResourceManager.PrivateLinkResourceListResult | ------ | --------------------------------------- | ------------------------------- | | value? | `ResourceManager.PrivateLinkResource[]` | Array of private link resources | -### `PrivateLinkResourceParameter` {#Azure.ResourceManager.PrivateLinkResourceParameter} - -The name of the private link associated with the Azure resource. - -```typespec -model Azure.ResourceManager.PrivateLinkResourceParameter -``` - -#### Template Parameters - -| Name | Description | -| ------- | -------------------------------------------------------------------------- | -| Segment | The resource type name for private links (default is privateLinkResources) | - -#### Properties - -| Name | Type | Description | -| ---- | -------- | ---------------------------------------------------------------- | -| name | `string` | The name of the private link associated with the Azure resource. | - ### `PrivateLinkResourceProperties` {#Azure.ResourceManager.PrivateLinkResourceProperties} Properties of a private link resource. @@ -818,22 +687,6 @@ model Azure.ResourceManager.PrivateLinkResourceProperties | requiredMembers? | `string[]` | The private link resource required member names. | | requiredZoneNames? | `string[]` | The private link resource private link DNS zone name. | -### `PrivateLinkServiceConnectionState` {#Azure.ResourceManager.PrivateLinkServiceConnectionState} - -A collection of information about the state of the connection between service consumer and provider. - -```typespec -model Azure.ResourceManager.PrivateLinkServiceConnectionState -``` - -#### Properties - -| Name | Type | Description | -| ---------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| status? | [`PrivateEndpointServiceConnectionStatus`](./data-types.md#Azure.ResourceManager.PrivateEndpointServiceConnectionStatus) | Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. | -| description? | `string` | The reason for approval/rejection of the connection. | -| actionsRequired? | `string` | A message indicating if changes on the service provider require any updates on the consumer. | - ### `ProviderNamespace` {#Azure.ResourceManager.ProviderNamespace} Model describing the provider namespace. @@ -1041,7 +894,7 @@ model Foo is TrackedResource { | Name | Type | Description | | ----- | ---------------------------------------------------------------- | ----------------------------- | -| plan? | [`Plan`](./data-types.md#Azure.ResourceManager.Foundations.Plan) | Details of the resource plan. | +| plan? | [`Plan`](./data-types.md#Azure.ResourceManager.CommonTypes.Plan) | Details of the resource plan. | ### `ResourceSkuProperty` {#Azure.ResourceManager.ResourceSkuProperty} @@ -1065,7 +918,7 @@ model Foo is TrackedResource { | Name | Type | Description | | ---- | -------------------------------------------------------------- | ------------------------------------------------------- | -| sku? | [`Sku`](./data-types.md#Azure.ResourceManager.Foundations.Sku) | The SKU (Stock Keeping Unit) assigned to this resource. | +| sku? | [`Sku`](./data-types.md#Azure.ResourceManager.CommonTypes.Sku) | The SKU (Stock Keeping Unit) assigned to this resource. | ### `ResourceUriParameter` {#Azure.ResourceManager.ResourceUriParameter} @@ -1081,20 +934,6 @@ model Azure.ResourceManager.ResourceUriParameter | ----------- | -------- | ---------------------------------------------------------------------- | | resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | -### `SubscriptionIdParameter` {#Azure.ResourceManager.SubscriptionIdParameter} - -The default subscriptionId parameter type. - -```typespec -model Azure.ResourceManager.SubscriptionIdParameter -``` - -#### Properties - -| Name | Type | Description | -| -------------- | -------- | ---------------------------------- | -| subscriptionId | `string` | The ID of the target subscription. | - ### `SubscriptionLocationResource` {#Azure.ResourceManager.SubscriptionLocationResource} The location resource for subscription-based locations. This can be used as a parent @@ -1155,38 +994,6 @@ Supported versions of Azure.ResourceManager building blocks. enum Azure.ResourceManager.Versions ``` -### `InfrastructureEncryption` {#Azure.ResourceManager.InfrastructureEncryption} - -(Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled. - -```typespec -union Azure.ResourceManager.InfrastructureEncryption -``` - -### `KeyEncryptionKeyIdentity` {#Azure.ResourceManager.KeyEncryptionKeyIdentity} - -The type of identity to use. - -```typespec -union Azure.ResourceManager.KeyEncryptionKeyIdentity -``` - -### `PrivateEndpointConnectionProvisioningState` {#Azure.ResourceManager.PrivateEndpointConnectionProvisioningState} - -The provisioning state of the connection - -```typespec -union Azure.ResourceManager.PrivateEndpointConnectionProvisioningState -``` - -### `PrivateEndpointServiceConnectionStatus` {#Azure.ResourceManager.PrivateEndpointServiceConnectionStatus} - -The private endpoint connection status - -```typespec -union Azure.ResourceManager.PrivateEndpointServiceConnectionStatus -``` - ### `ResourceProvisioningState` {#Azure.ResourceManager.ResourceProvisioningState} Standard terminal provisioning state of resource type. You can include in your @@ -1210,24 +1017,29 @@ union FooProvisioningState { ## Azure.ResourceManager.CommonTypes -### `Versions` {#Azure.ResourceManager.CommonTypes.Versions} +### `ApiVersionParameter` {#Azure.ResourceManager.CommonTypes.ApiVersionParameter} -The Azure Resource Manager common-types versions. +The default api-version parameter type. ```typespec -enum Azure.ResourceManager.CommonTypes.Versions +model Azure.ResourceManager.CommonTypes.ApiVersionParameter ``` -## Azure.ResourceManager.Foundations +#### Properties + +| Name | Type | Description | +| ---------- | -------- | ------------------------------------------ | +| apiVersion | `string` | The API version to use for this operation. | -### `ArmTagsProperty` {#Azure.ResourceManager.Foundations.ArmTagsProperty} +### `ArmTagsProperty` {#Azure.ResourceManager.CommonTypes.ArmTagsProperty} Standard type definition for Azure Resource Manager Tags property. It is included in the TrackedResource template definition. +The Azure Resource Manager Resource tags. ```typespec -model Azure.ResourceManager.Foundations.ArmTagsProperty +model Azure.ResourceManager.CommonTypes.ArmTagsProperty ``` #### Properties @@ -1236,12 +1048,12 @@ model Azure.ResourceManager.Foundations.ArmTagsProperty | ----- | ---------------- | -------------- | | tags? | `Record` | Resource tags. | -### `AzureEntityResource` {#Azure.ResourceManager.Foundations.AzureEntityResource} +### `AzureEntityResource` {#Azure.ResourceManager.CommonTypes.AzureEntityResource} The resource model definition for an Azure Resource Manager resource with an etag. ```typespec -model Azure.ResourceManager.Foundations.AzureEntityResource +model Azure.ResourceManager.CommonTypes.AzureEntityResource ``` #### Properties @@ -1250,12 +1062,13 @@ model Azure.ResourceManager.Foundations.AzureEntityResource | ---- | -------- | -------------- | | etag | `string` | Resource Etag. | -### `CheckNameAvailabilityRequest` {#Azure.ResourceManager.Foundations.CheckNameAvailabilityRequest} +### `CheckNameAvailabilityRequest` {#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest} +The check availability request body. The check availability request body. ```typespec -model Azure.ResourceManager.Foundations.CheckNameAvailabilityRequest +model Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest ``` #### Properties @@ -1265,12 +1078,13 @@ model Azure.ResourceManager.Foundations.CheckNameAvailabilityRequest | name? | `string` | The name of the resource for which availability needs to be checked. | | type? | `string` | The resource type. | -### `CheckNameAvailabilityResponse` {#Azure.ResourceManager.Foundations.CheckNameAvailabilityResponse} +### `CheckNameAvailabilityResponse` {#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse} +The check availability result. The check availability result. ```typespec -model Azure.ResourceManager.Foundations.CheckNameAvailabilityResponse +model Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse ``` #### Properties @@ -1278,39 +1092,49 @@ model Azure.ResourceManager.Foundations.CheckNameAvailabilityResponse | Name | Type | Description | | -------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | | nameAvailable? | `boolean` | Indicates if the resource name is available. | -| reason? | [`CheckNameAvailabilityReason`](./data-types.md#Azure.ResourceManager.Foundations.CheckNameAvailabilityReason) | The reason why the given name is not available. | +| reason? | [`CheckNameAvailabilityReason`](./data-types.md#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason) | The reason why the given name is not available. | | message? | `string` | Detailed reason why the given name is not available. | -### `DefaultBaseParameters` {#Azure.ResourceManager.Foundations.DefaultBaseParameters} +### `CustomerManagedKeyEncryption` {#Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption} -Base parameters for a resource. +Customer-managed key encryption properties for the resource. ```typespec -model Azure.ResourceManager.Foundations.DefaultBaseParameters +model Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption ``` -#### Template Parameters +#### Properties -| Name | Description | -| -------- | ------------------------- | -| Resource | The type of the resource. | +| Name | Type | Description | +| ------------------------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| keyEncryptionKeyIdentity? | [`KeyEncryptionKeyIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity) | The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. | +| userAssignedIdentityResourceId? | `Core.armResourceIdentifier` | User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. | +| federatedClientId? | `Core.uuid` | application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540 | +| delegatedIdentityClientId? | `Core.uuid` | delegated identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity and userAssignedIdentity - internal use only. | + +### `EncryptionConfiguration` {#Azure.ResourceManager.CommonTypes.EncryptionConfiguration} + +All encryption configuration for a resource. + +```typespec +model Azure.ResourceManager.CommonTypes.EncryptionConfiguration +``` #### Properties -| Name | Type | Description | -| ----------------- | -------- | ---------------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| location | `string` | The location name. | -| resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | -| resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | +| Name | Type | Description | +| ----------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| infrastructureEncryption? | [`InfrastructureEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.InfrastructureEncryption) | Indicates if infrastructure encryption is enabled or disabled. | +| customerManagedKeyEncryption? | [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption) | All customer-managed key encryption properties for the resource. | +| keyEncryptionKeyUrl? | `string` | key encryption key Url, versioned or unversioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. | -### `ErrorAdditionalInfo` {#Azure.ResourceManager.Foundations.ErrorAdditionalInfo} +### `ErrorAdditionalInfo` {#Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo} +The resource management error additional info. The resource management error additional info. ```typespec -model Azure.ResourceManager.Foundations.ErrorAdditionalInfo +model Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo ``` #### Properties @@ -1320,12 +1144,13 @@ model Azure.ResourceManager.Foundations.ErrorAdditionalInfo | type? | `string` | The additional info type. | | info? | `{}` | The additional info. | -### `ErrorDetail` {#Azure.ResourceManager.Foundations.ErrorDetail} +### `ErrorDetail` {#Azure.ResourceManager.CommonTypes.ErrorDetail} +The error detail. The error detail. ```typespec -model Azure.ResourceManager.Foundations.ErrorDetail +model Azure.ResourceManager.CommonTypes.ErrorDetail ``` #### Properties @@ -1335,15 +1160,15 @@ model Azure.ResourceManager.Foundations.ErrorDetail | code? | `string` | The error code. | | message? | `string` | The error message. | | target? | `string` | The error target. | -| details? | `ResourceManager.Foundations.ErrorDetail[]` | The error details. | -| additionalInfo? | `ResourceManager.Foundations.ErrorAdditionalInfo[]` | The error additional info. | +| details? | `ResourceManager.CommonTypes.ErrorDetail[]` | The error details. | +| additionalInfo? | `ResourceManager.CommonTypes.ErrorAdditionalInfo[]` | The error additional info. | -### `ExtendedLocation` {#Azure.ResourceManager.Foundations.ExtendedLocation} +### `ExtendedLocation` {#Azure.ResourceManager.CommonTypes.ExtendedLocation} The complex type of the extended location. ```typespec -model Azure.ResourceManager.Foundations.ExtendedLocation +model Azure.ResourceManager.CommonTypes.ExtendedLocation ``` #### Properties @@ -1351,227 +1176,612 @@ model Azure.ResourceManager.Foundations.ExtendedLocation | Name | Type | Description | | ---- | ------------------------------------------------------------------------------------------------ | ---------------------------------- | | name | `string` | The name of the extended location. | -| type | [`ExtendedLocationType`](./data-types.md#Azure.ResourceManager.Foundations.ExtendedLocationType) | The type of the extended location. | +| type | [`ExtendedLocationType`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtendedLocationType) | The type of the extended location. | -### `ExtensionBaseParameters` {#Azure.ResourceManager.Foundations.ExtensionBaseParameters} +### `ExtensionResource` {#Azure.ResourceManager.CommonTypes.ExtensionResource} -The static parameters for an extension resource +The base extension resource. +The base extension resource. ```typespec -model Azure.ResourceManager.Foundations.ExtensionBaseParameters +model Azure.ResourceManager.CommonTypes.ExtensionResource ``` #### Properties -| Name | Type | Description | -| ----------- | -------- | ---------------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | +None -### `ExtensionResource` {#Azure.ResourceManager.Foundations.ExtensionResource} +### `ManagedServiceIdentity` {#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity} -The base extension resource. +The properties of the managed service identities assigned to this resource. ```typespec -model Azure.ResourceManager.Foundations.ExtensionResource +model Azure.ResourceManager.CommonTypes.ManagedServiceIdentity ``` #### Properties -None +| Name | Type | Description | +| ----------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------- | +| tenantId? | `string` | The Active Directory tenant id of the principal. | +| principalId? | `string` | The active directory identifier of this principal. | +| type | [`ManagedServiceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType) | The type of managed identity assigned to this resource. | +| userAssignedIdentities? | `Record` | The identities assigned to this resource by the user. | -### `ExtensionScope` {#Azure.ResourceManager.Foundations.ExtensionScope} +### `Operation` {#Azure.ResourceManager.CommonTypes.Operation} -Parameter model for listing an extension resource +Details of a REST API operation, returned from the Resource Provider Operations API +Details of a REST API operation, returned from the Resource Provider Operations API ```typespec -model Azure.ResourceManager.Foundations.ExtensionScope +model Azure.ResourceManager.CommonTypes.Operation ``` -#### Template Parameters - -| Name | Description | -| -------- | ------------------------- | -| Resource | The type of the resource. | - #### Properties -| Name | Type | Description | -| ----------- | -------------------------------- | ---------------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| Name | Type | Description | +| ------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name? | `string` | The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" | +| isDataAction? | `boolean` | Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. | +| display? | [`OperationDisplay`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationDisplay) | Localized display information for this particular operation. | +| origin? | [`Origin`](./data-types.md#Azure.ResourceManager.CommonTypes.Origin) | The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" | +| actionType? | [`ActionType`](./data-types.md#Azure.ResourceManager.CommonTypes.ActionType) | Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. | -### `LocationBaseParameters` {#Azure.ResourceManager.Foundations.LocationBaseParameters} +### `OperationDisplay` {#Azure.ResourceManager.CommonTypes.OperationDisplay} -The static parameters for a location-based resource +Localized display information for and operation. +Localized display information for and operation. ```typespec -model Azure.ResourceManager.Foundations.LocationBaseParameters +model Azure.ResourceManager.CommonTypes.OperationDisplay ``` #### Properties -| Name | Type | Description | -| -------------- | -------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| location | `string` | The location name. | +| Name | Type | Description | +| ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| provider? | `string` | The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". | +| resource? | `string` | The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". | +| operation? | `string` | The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". | +| description? | `string` | The short, localized friendly description of the operation; suitable for tool tips and detailed views. | -### `LocationScope` {#Azure.ResourceManager.Foundations.LocationScope} +### `OperationIdParameter` {#Azure.ResourceManager.CommonTypes.OperationIdParameter} -Parameter model for listing a resource at the location scope +The default operationId parameter type. +The default operationId parameter type. ```typespec -model Azure.ResourceManager.Foundations.LocationScope +model Azure.ResourceManager.CommonTypes.OperationIdParameter ``` -#### Template Parameters - -| Name | Description | -| -------- | ------------------------- | -| Resource | The type of the resource. | - #### Properties -| Name | Type | Description | -| -------------- | -------------------------------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| location | `string` | The location name. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| Name | Type | Description | +| ----------- | -------- | ------------------------------------- | +| operationId | `string` | The ID of an ongoing async operation. | -### `ManagedServiceIdentity` {#Azure.ResourceManager.Foundations.ManagedServiceIdentity} +### `OperationListResult` {#Azure.ResourceManager.CommonTypes.OperationListResult} -The properties of the managed service identities assigned to this resource. +A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. +A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. ```typespec -model Azure.ResourceManager.Foundations.ManagedServiceIdentity +model Azure.ResourceManager.CommonTypes.OperationListResult ``` #### Properties -| Name | Type | Description | -| ----------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------- | -| tenantId? | `string` | The Active Directory tenant id of the principal. | -| principalId? | `string` | The active directory identifier of this principal. | -| type | [`ManagedServiceIdentityType`](./data-types.md#Azure.ResourceManager.Foundations.ManagedServiceIdentityType) | The type of managed identity assigned to this resource. | -| userAssignedIdentities? | `Record` | The identities assigned to this resource by the user. | +| Name | Type | Description | +| --------- | ----------------------------------------- | ---------------------------------- | +| value | `ResourceManager.CommonTypes.Operation[]` | The Operation items on this page | +| nextLink? | `TypeSpec.Rest.ResourceLocation` | The link to the next page of items | + +### `OperationStatusResult` {#Azure.ResourceManager.CommonTypes.OperationStatusResult} + +The current status of an async operation. +The current status of an async operation. + +```typespec +model Azure.ResourceManager.CommonTypes.OperationStatusResult +``` + +#### Properties + +| Name | Type | Description | +| ---------------- | ------------------------------------------------------------------------------ | ------------------------------------------- | +| id? | `string` | Fully qualified ID for the async operation. | +| name? | `string` | Name of the async operation. | +| status | `string` | Operation status. | +| percentComplete? | `float64` | Percent of the operation that is complete. | +| startTime? | `utcDateTime` | The start time of the operation. | +| endTime? | `utcDateTime` | The end time of the operation. | +| operations | `ResourceManager.CommonTypes.OperationStatusResult[]` | The operations list. | +| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) | If present, details of the operation error. | + +### `Plan` {#Azure.ResourceManager.CommonTypes.Plan} + +Details of the resource plan. +Details of the resource plan. + +```typespec +model Azure.ResourceManager.CommonTypes.Plan +``` + +#### Properties + +| Name | Type | Description | +| -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | `string` | A user defined name of the 3rd Party Artifact that is being procured. | +| publisher | `string` | The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic | +| product | `string` | 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. | +| promotionCode? | `string` | A publisher provided promotion code as provisioned in Data Market for the said product/artifact. | +| version? | `string` | The version of the desired product/artifact. | + +### `PrivateEndpoint` {#Azure.ResourceManager.CommonTypes.PrivateEndpoint} + +The private endpoint resource + +```typespec +model Azure.ResourceManager.CommonTypes.PrivateEndpoint +``` + +#### Properties + +| Name | Type | Description | +| ---- | ---------------------------- | -------------------------------------------- | +| id? | `Core.armResourceIdentifier` | The resource identifier for private endpoint | + +### `PrivateEndpointConnection` {#Azure.ResourceManager.CommonTypes.PrivateEndpointConnection} + +The private endpoint connection resource + +```typespec +model Azure.ResourceManager.CommonTypes.PrivateEndpointConnection +``` + +#### Properties + +| Name | Type | Description | +| ----------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------ | +| properties? | [`PrivateEndpointConnectionProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties) | The private endpoint connection properties | + +### `PrivateEndpointConnectionParameter` {#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionParameter} + +The name of the private endpoint connection associated with the Azure resource. + +```typespec +model Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionParameter +``` + +#### Template Parameters + +| Name | Description | +| ------- | ----------------------------------------------------------------------------------------------- | +| Segment | The resource type name for private endpoint connections (default is privateEndpointConnections) | + +#### Properties + +| Name | Type | Description | +| ---- | -------- | ------------------------------------------------------------------------------- | +| name | `string` | The name of the private endpoint connection associated with the Azure resource. | + +### `PrivateEndpointConnectionProperties` {#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties} + +Properties of he private endpoint connection resource + +```typespec +model Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties +``` + +#### Properties + +| Name | Type | Description | +| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| groupIds? | `string[]` | The group identifiers for the private endpoint resource | +| privateEndpoint? | [`PrivateEndpoint`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpoint) | The private endpoint resource | +| privateLinkServiceConnectionState | [`PrivateLinkServiceConnectionState`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState) | A collection of information about the state of the connection between service consumer and provider. | +| provisioningState? | [`PrivateEndpointConnectionProvisioningState`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState) | The provisioning state of the private endpoint connection resource. | + +### `PrivateLinkResourceParameter` {#Azure.ResourceManager.CommonTypes.PrivateLinkResourceParameter} + +The name of the private link associated with the Azure resource. + +```typespec +model Azure.ResourceManager.CommonTypes.PrivateLinkResourceParameter +``` + +#### Template Parameters + +| Name | Description | +| ------- | -------------------------------------------------------------------------- | +| Segment | The resource type name for private links (default is privateLinkResources) | + +#### Properties + +| Name | Type | Description | +| ---- | -------- | ---------------------------------------------------------------- | +| name | `string` | The name of the private link associated with the Azure resource. | + +### `PrivateLinkServiceConnectionState` {#Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState} + +A collection of information about the state of the connection between service consumer and provider. + +```typespec +model Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState +``` + +#### Properties + +| Name | Type | Description | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| status? | [`PrivateEndpointServiceConnectionStatus`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus) | Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. | +| description? | `string` | The reason for approval/rejection of the connection. | +| actionsRequired? | `string` | A message indicating if changes on the service provider require any updates on the consumer. | + +### `ProxyResource` {#Azure.ResourceManager.CommonTypes.ProxyResource} + +The base proxy resource. +The base proxy resource. + +```typespec +model Azure.ResourceManager.CommonTypes.ProxyResource +``` + +#### Properties + +None + +### `Resource` {#Azure.ResourceManager.CommonTypes.Resource} + +Base model that defines common properties for all Azure Resource Manager resources. +Common properties for all Azure Resource Manager resources. + +```typespec +model Azure.ResourceManager.CommonTypes.Resource +``` + +#### Properties + +| Name | Type | Description | +| ----------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| idV3? | `string` | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} | +| id? | `Core.uuid` | Fully qualified resource ID for the resource. E.g. \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}\" | +| name? | `string` | The name of the resource | +| type? | `string` | The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\ | +| systemData? | [`SystemData`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemData) | Azure Resource Manager metadata containing createdBy and modifiedBy information. | + +### `Sku` {#Azure.ResourceManager.CommonTypes.Sku} + +The SKU (Stock Keeping Unit) assigned to this resource. +The SKU (Stock Keeping Unit) assigned to this resource. + +```typespec +model Azure.ResourceManager.CommonTypes.Sku +``` + +#### Properties + +| Name | Type | Description | +| --------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | `string` | The name of the SKU, usually a combination of letters and numbers, for example, 'P3' | +| tier? | [`SkuTier`](./data-types.md#Azure.ResourceManager.CommonTypes.SkuTier) | 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. | +| size? | `string` | The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. | +| family? | `string` | If the service has different generations of hardware, for the same SKU, then that can be captured here. | +| capacity? | `int32` | 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. | + +### `SubscriptionIdParameter` {#Azure.ResourceManager.CommonTypes.SubscriptionIdParameter} + +The default subscriptionId parameter type. + +```typespec +model Azure.ResourceManager.CommonTypes.SubscriptionIdParameter +``` + +#### Properties + +| Name | Type | Description | +| -------------- | -------- | ---------------------------------- | +| subscriptionId | `string` | The ID of the target subscription. | + +### `SystemAssignedServiceIdentity` {#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity} + +The properties of the service-assigned identity associated with this resource. + +```typespec +model Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity +``` + +#### Properties + +| Name | Type | Description | +| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | +| tenantId? | `string` | The Active Directory tenant id of the principal. | +| principalId? | `string` | The active directory identifier of this principal. | +| type | [`SystemAssignedServiceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType) | The type of managed identity assigned to this resource. | + +### `SystemData` {#Azure.ResourceManager.CommonTypes.SystemData} + +Metadata pertaining to creation and last modification of the resource. +Metadata pertaining to creation and last modification of the resource. + +```typespec +model Azure.ResourceManager.CommonTypes.SystemData +``` + +#### Properties + +| Name | Type | Description | +| ------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------- | +| createdBy? | `string` | The identity that created the resource. | +| createdByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.CommonTypes.createdByType) | The type of identity that created the resource. | +| createdAt? | `plainDate` | The type of identity that created the resource. | +| lastModifiedBy? | `string` | The identity that last modified the resource. | +| lastModifiedByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.CommonTypes.createdByType) | The type of identity that last modified the resource. | +| lastModifiedAt? | `plainDate` | The timestamp of resource last modification (UTC) | + +### `TrackedResource` {#Azure.ResourceManager.CommonTypes.TrackedResource} + +The base tracked resource. +The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' + +```typespec +model Azure.ResourceManager.CommonTypes.TrackedResource +``` + +#### Properties + +| Name | Type | Description | +| -------- | ---------------- | ----------------------------------------- | +| location | `string` | The geo-location where the resource lives | +| tags? | `Record` | Resource tags. | + +### `UserAssignedIdentities` {#Azure.ResourceManager.CommonTypes.UserAssignedIdentities} + +The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", + +```typespec +model Azure.ResourceManager.CommonTypes.UserAssignedIdentities +``` + +#### Properties + +| Name | Type | Description | +| ---- | ------------------------------------------------------------------------------------------------ | --------------------- | +| | [`UserAssignedIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.UserAssignedIdentity) | Additional properties | + +### `UserAssignedIdentity` {#Azure.ResourceManager.CommonTypes.UserAssignedIdentity} + +A managed identity assigned by the user. + +```typespec +model Azure.ResourceManager.CommonTypes.UserAssignedIdentity +``` + +#### Properties + +| Name | Type | Description | +| ------------ | -------- | ---------------------------------------------------------- | +| clientId? | `string` | The active directory client identifier for this principal. | +| principalId? | `string` | The active directory identifier for this principal. | + +### `ResourceHome` {#Azure.ResourceManager.CommonTypes.ResourceHome} + +An internal enum to indicate the resource support for various path types + +```typespec +enum Azure.ResourceManager.CommonTypes.ResourceHome +``` + +### `SkuTier` {#Azure.ResourceManager.CommonTypes.SkuTier} + +Available service tiers for the SKU. +Available service tiers for the SKU. + +```typespec +enum Azure.ResourceManager.CommonTypes.SkuTier +``` + +### `Versions` {#Azure.ResourceManager.CommonTypes.Versions} + +The Azure Resource Manager common-types versions. + +```typespec +enum Azure.ResourceManager.CommonTypes.Versions +``` + +### `ActionType` {#Azure.ResourceManager.CommonTypes.ActionType} + +Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + +```typespec +union Azure.ResourceManager.CommonTypes.ActionType +``` + +### `CheckNameAvailabilityReason` {#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason} + +Possible reasons for a name not being available. +Possible reasons for a name not being available. + +```typespec +union Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason +``` + +### `createdByType` {#Azure.ResourceManager.CommonTypes.createdByType} + +The kind of entity that created the resource. +The kind of entity that created the resource. + +```typespec +union Azure.ResourceManager.CommonTypes.createdByType +``` + +### `ExtendedLocationType` {#Azure.ResourceManager.CommonTypes.ExtendedLocationType} + +The supported ExtendedLocation types. + +```typespec +union Azure.ResourceManager.CommonTypes.ExtendedLocationType +``` + +### `InfrastructureEncryption` {#Azure.ResourceManager.CommonTypes.InfrastructureEncryption} + +(Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled. + +```typespec +union Azure.ResourceManager.CommonTypes.InfrastructureEncryption +``` + +### `KeyEncryptionKeyIdentity` {#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity} + +The type of identity to use. + +```typespec +union Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity +``` + +### `ManagedServiceIdentityType` {#Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType} + +The kind of managed identity assigned to this resource. + +```typespec +union Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType +``` + +### `Origin` {#Azure.ResourceManager.CommonTypes.Origin} + +The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" +The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" -### `Operation` {#Azure.ResourceManager.Foundations.Operation} +```typespec +union Azure.ResourceManager.CommonTypes.Origin +``` -Details of a REST API operation, returned from the Resource Provider Operations API +### `PrivateEndpointConnectionProvisioningState` {#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState} + +The provisioning state of the connection ```typespec -model Azure.ResourceManager.Foundations.Operation +union Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState ``` -#### Properties +### `PrivateEndpointServiceConnectionStatus` {#Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus} -| Name | Type | Description | -| ------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name? | `string` | The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" | -| isDataAction? | `boolean` | Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. | -| display? | [`OperationDisplay`](./data-types.md#Azure.ResourceManager.Foundations.OperationDisplay) | Localized display information for this particular operation. | -| origin? | [`Origin`](./data-types.md#Azure.ResourceManager.Foundations.Origin) | The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" | -| actionType? | [`ActionType`](./data-types.md#Azure.ResourceManager.Foundations.ActionType) | Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. | +The private endpoint connection status -### `OperationDisplay` {#Azure.ResourceManager.Foundations.OperationDisplay} +```typespec +union Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus +``` -Localized display information for and operation. +### `SystemAssignedServiceIdentityType` {#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType} + +The kind of managemed identity assigned to this resource. ```typespec -model Azure.ResourceManager.Foundations.OperationDisplay +union Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType ``` -#### Properties - -| Name | Type | Description | -| ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| provider? | `string` | The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". | -| resource? | `string` | The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". | -| operation? | `string` | The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". | -| description? | `string` | The short, localized friendly description of the operation; suitable for tool tips and detailed views. | +## Azure.ResourceManager.Foundations -### `OperationIdParameter` {#Azure.ResourceManager.Foundations.OperationIdParameter} +### `DefaultBaseParameters` {#Azure.ResourceManager.Foundations.DefaultBaseParameters} -The default operationId parameter type. +Base parameters for a resource. ```typespec -model Azure.ResourceManager.Foundations.OperationIdParameter +model Azure.ResourceManager.Foundations.DefaultBaseParameters ``` +#### Template Parameters + +| Name | Description | +| -------- | ------------------------- | +| Resource | The type of the resource. | + #### Properties -| Name | Type | Description | -| ----------- | -------- | ------------------------------------- | -| operationId | `string` | The ID of an ongoing async operation. | +| Name | Type | Description | +| ----------------- | -------- | ---------------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `string` | The ID of the target subscription. | +| location | `string` | The location name. | +| resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | +| resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | -### `OperationListResult` {#Azure.ResourceManager.Foundations.OperationListResult} +### `ExtensionBaseParameters` {#Azure.ResourceManager.Foundations.ExtensionBaseParameters} -A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. +The static parameters for an extension resource ```typespec -model Azure.ResourceManager.Foundations.OperationListResult +model Azure.ResourceManager.Foundations.ExtensionBaseParameters ``` #### Properties -| Name | Type | Description | -| --------- | ----------------------------------------- | ---------------------------------- | -| value | `ResourceManager.Foundations.Operation[]` | The Operation items on this page | -| nextLink? | `TypeSpec.Rest.ResourceLocation` | The link to the next page of items | +| Name | Type | Description | +| ----------- | -------- | ---------------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | -### `OperationStatusResult` {#Azure.ResourceManager.Foundations.OperationStatusResult} +### `ExtensionScope` {#Azure.ResourceManager.Foundations.ExtensionScope} -The current status of an async operation. +Parameter model for listing an extension resource ```typespec -model Azure.ResourceManager.Foundations.OperationStatusResult +model Azure.ResourceManager.Foundations.ExtensionScope ``` +#### Template Parameters + +| Name | Description | +| -------- | ------------------------- | +| Resource | The type of the resource. | + #### Properties -| Name | Type | Description | -| ---------------- | ------------------------------------------------------------------------------ | ------------------------------------------- | -| id? | `string` | Fully qualified ID for the async operation. | -| name? | `string` | Name of the async operation. | -| status | `string` | Operation status. | -| percentComplete? | `float64` | Percent of the operation that is complete. | -| startTime? | `utcDateTime` | The start time of the operation. | -| endTime? | `utcDateTime` | The end time of the operation. | -| operations | `ResourceManager.Foundations.OperationStatusResult[]` | The operations list. | -| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.Foundations.ErrorDetail) | If present, details of the operation error. | +| Name | Type | Description | +| ----------- | -------------------------------- | ---------------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | -### `Plan` {#Azure.ResourceManager.Foundations.Plan} +### `LocationBaseParameters` {#Azure.ResourceManager.Foundations.LocationBaseParameters} -Details of the resource plan. +The static parameters for a location-based resource ```typespec -model Azure.ResourceManager.Foundations.Plan +model Azure.ResourceManager.Foundations.LocationBaseParameters ``` #### Properties -| Name | Type | Description | -| -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | `string` | A user defined name of the 3rd Party Artifact that is being procured. | -| publisher | `string` | The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic | -| product | `string` | 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. | -| promotionCode? | `string` | A publisher provided promotion code as provisioned in Data Market for the said product/artifact. | -| version? | `string` | The version of the desired product/artifact. | +| Name | Type | Description | +| -------------- | -------- | ------------------------------------------ | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `string` | The ID of the target subscription. | +| location | `string` | The location name. | -### `ProxyResource` {#Azure.ResourceManager.Foundations.ProxyResource} +### `LocationScope` {#Azure.ResourceManager.Foundations.LocationScope} -The base proxy resource. +Parameter model for listing a resource at the location scope ```typespec -model Azure.ResourceManager.Foundations.ProxyResource +model Azure.ResourceManager.Foundations.LocationScope ``` +#### Template Parameters + +| Name | Description | +| -------- | ------------------------- | +| Resource | The type of the resource. | + #### Properties -None +| Name | Type | Description | +| -------------- | -------------------------------- | ------------------------------------------ | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `string` | The ID of the target subscription. | +| location | `string` | The location name. | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `ProxyResourceUpdateModel` {#Azure.ResourceManager.Foundations.ProxyResourceUpdateModel} @@ -1594,23 +1804,6 @@ model Azure.ResourceManager.Foundations.ProxyResourceUpdateModel` | | -### `Resource` {#Azure.ResourceManager.Foundations.Resource} - -Base model that defines common properties for all Azure Resource Manager resources. - -```typespec -model Azure.ResourceManager.Foundations.Resource -``` - -#### Properties - -| Name | Type | Description | -| ----------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| id? | `string` | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} | -| name? | `string` | The name of the resource | -| type? | `string` | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | -| systemData? | [`SystemData`](./data-types.md#Azure.ResourceManager.Foundations.SystemData) | Azure Resource Manager metadata containing createdBy and modifiedBy information. | - ### `ResourceGroupBaseParameters` {#Azure.ResourceManager.Foundations.ResourceGroupBaseParameters} The static parameters for a resource-group based resource @@ -1694,24 +1887,6 @@ model Azure.ResourceManager.Foundations.ResourceUpdateModelProperties | subscriptionId | `string` | The ID of the target subscription. | | provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | -### `SystemAssignedServiceIdentity` {#Azure.ResourceManager.Foundations.SystemAssignedServiceIdentity} - -The properties of the service-assigned identity associated with this resource. - -```typespec -model Azure.ResourceManager.Foundations.SystemAssignedServiceIdentity -``` - -#### Properties - -| Name | Type | Description | -| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | -| tenantId? | `string` | The Active Directory tenant id of the principal. | -| principalId? | `string` | The active directory identifier of this principal. | -| type | [`SystemAssignedServiceIdentityType`](./data-types.md#Azure.ResourceManager.Foundations.SystemAssignedServiceIdentityType) | The type of managed identity assigned to this resource. | - -### `SystemData` {#Azure.ResourceManager.Foundations.SystemData} - -Metadata pertaining to creation and last modification of the resource. - -```typespec -model Azure.ResourceManager.Foundations.SystemData -``` - -#### Properties - -| Name | Type | Description | -| ------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------- | -| createdBy? | `string` | The identity that created the resource. | -| createdByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.Foundations.createdByType) | The type of identity that created the resource. | -| createdAt? | `plainDate` | The type of identity that created the resource. | -| lastModifiedBy? | `string` | The identity that last modified the resource. | -| lastModifiedByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.Foundations.createdByType) | The type of identity that last modified the resource. | -| lastModifiedAt? | `plainDate` | The timestamp of resource last modification (UTC) | - ### `TagsUpdateModel` {#Azure.ResourceManager.Foundations.TagsUpdateModel} The type used for updating tags in resources. @@ -1838,119 +1978,3 @@ model Azure.ResourceManager.Foundations.TenantScope | ---------- | -------------------------------- | ------------------------------------------ | | apiVersion | `string` | The API version to use for this operation. | | provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | - -### `TrackedResource` {#Azure.ResourceManager.Foundations.TrackedResource} - -The base tracked resource. - -```typespec -model Azure.ResourceManager.Foundations.TrackedResource -``` - -#### Properties - -| Name | Type | Description | -| -------- | ---------------- | ----------------------------------------- | -| location | `string` | The geo-location where the resource lives | -| tags? | `Record` | Resource tags. | - -### `UserAssignedIdentities` {#Azure.ResourceManager.Foundations.UserAssignedIdentities} - -The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", - -```typespec -model Azure.ResourceManager.Foundations.UserAssignedIdentities -``` - -#### Properties - -| Name | Type | Description | -| ---- | ------------------------------------------------------------------------------------------------ | --------------------- | -| | [`UserAssignedIdentity`](./data-types.md#Azure.ResourceManager.Foundations.UserAssignedIdentity) | Additional properties | - -### `UserAssignedIdentity` {#Azure.ResourceManager.Foundations.UserAssignedIdentity} - -A managed identity assigned by the user. - -```typespec -model Azure.ResourceManager.Foundations.UserAssignedIdentity -``` - -#### Properties - -| Name | Type | Description | -| ------------ | -------- | ---------------------------------------------------------- | -| clientId? | `string` | The active directory client identifier for this principal. | -| principalId? | `string` | The active directory identifier for this principal. | - -### `ResourceHome` {#Azure.ResourceManager.Foundations.ResourceHome} - -An internal enum to indicate the resource support for various path types - -```typespec -enum Azure.ResourceManager.Foundations.ResourceHome -``` - -### `SkuTier` {#Azure.ResourceManager.Foundations.SkuTier} - -Available service tiers for the SKU. - -```typespec -enum Azure.ResourceManager.Foundations.SkuTier -``` - -### `ActionType` {#Azure.ResourceManager.Foundations.ActionType} - -Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - -```typespec -union Azure.ResourceManager.Foundations.ActionType -``` - -### `CheckNameAvailabilityReason` {#Azure.ResourceManager.Foundations.CheckNameAvailabilityReason} - -Possible reasons for a name not being available. - -```typespec -union Azure.ResourceManager.Foundations.CheckNameAvailabilityReason -``` - -### `createdByType` {#Azure.ResourceManager.Foundations.createdByType} - -The kind of entity that created the resource. - -```typespec -union Azure.ResourceManager.Foundations.createdByType -``` - -### `ExtendedLocationType` {#Azure.ResourceManager.Foundations.ExtendedLocationType} - -The supported ExtendedLocation types. - -```typespec -union Azure.ResourceManager.Foundations.ExtendedLocationType -``` - -### `ManagedServiceIdentityType` {#Azure.ResourceManager.Foundations.ManagedServiceIdentityType} - -The kind of managed identity assigned to this resource. - -```typespec -union Azure.ResourceManager.Foundations.ManagedServiceIdentityType -``` - -### `Origin` {#Azure.ResourceManager.Foundations.Origin} - -The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - -```typespec -union Azure.ResourceManager.Foundations.Origin -``` - -### `SystemAssignedServiceIdentityType` {#Azure.ResourceManager.Foundations.SystemAssignedServiceIdentityType} - -The kind of managemed identity assigned to this resource. - -```typespec -union Azure.ResourceManager.Foundations.SystemAssignedServiceIdentityType -``` diff --git a/docs/libraries/azure-resource-manager/reference/decorators.md b/docs/libraries/azure-resource-manager/reference/decorators.md index 7f8fbcdc0b..5f7b56e4a6 100644 --- a/docs/libraries/azure-resource-manager/reference/decorators.md +++ b/docs/libraries/azure-resource-manager/reference/decorators.md @@ -14,7 +14,7 @@ This decorator is used either on a namespace or a version enum value to indicate the version of the Azure Resource Manager common-types to use for refs in emitted Swagger files. ```typespec -@Azure.ResourceManager.armCommonTypesVersion(version: valueof string | EnumMember) +@Azure.ResourceManager.armCommonTypesVersion(version: EnumMember) ``` #### Target @@ -23,9 +23,9 @@ the version of the Azure Resource Manager common-types to use for refs in emitte #### Parameters -| Name | Type | Description | -| ------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -| version | `valueof string \| EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version or an equivalent string value. | +| Name | Type | Description | +| ------- | ------------ | ------------------------------------------------------------------------------------ | +| version | `EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. | ### `@armLibraryNamespace` {#@Azure.ResourceManager.armLibraryNamespace} diff --git a/docs/libraries/azure-resource-manager/reference/index.mdx b/docs/libraries/azure-resource-manager/reference/index.mdx index 51360a7a56..f018278395 100644 --- a/docs/libraries/azure-resource-manager/reference/index.mdx +++ b/docs/libraries/azure-resource-manager/reference/index.mdx @@ -115,7 +115,6 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager ### Models -- [`ApiVersionParameter`](./data-types.md#Azure.ResourceManager.ApiVersionParameter) - [`ArmAcceptedLroResponse`](./data-types.md#Azure.ResourceManager.ArmAcceptedLroResponse) - [`ArmAcceptedResponse`](./data-types.md#Azure.ResourceManager.ArmAcceptedResponse) - [`ArmAsyncOperationHeader`](./data-types.md#Azure.ResourceManager.ArmAsyncOperationHeader) @@ -135,10 +134,8 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ArmResourceNotFoundResponse`](./data-types.md#Azure.ResourceManager.ArmResourceNotFoundResponse) - [`ArmResourceUpdatedResponse`](./data-types.md#Azure.ResourceManager.ArmResourceUpdatedResponse) - [`ArmResponse`](./data-types.md#Azure.ResourceManager.ArmResponse) -- [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CustomerManagedKeyEncryption) - [`DefaultProvisioningStateProperty`](./data-types.md#Azure.ResourceManager.DefaultProvisioningStateProperty) -- [`Encryption`](./data-types.md#Azure.ResourceManager.Encryption) -- [`EncryptionConfiguration`](./data-types.md#Azure.ResourceManager.EncryptionConfiguration) +- [`EncryptionProperty`](./data-types.md#Azure.ResourceManager.EncryptionProperty) - [`EntityTagProperty`](./data-types.md#Azure.ResourceManager.EntityTagProperty) - [`ErrorResponse`](./data-types.md#Azure.ResourceManager.ErrorResponse) - [`ExtendedLocationProperty`](./data-types.md#Azure.ResourceManager.ExtendedLocationProperty) @@ -150,16 +147,10 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ManagedServiceIdentityProperty`](./data-types.md#Azure.ResourceManager.ManagedServiceIdentityProperty) - [`ManagedSystemAssignedIdentityProperty`](./data-types.md#Azure.ResourceManager.ManagedSystemAssignedIdentityProperty) - [`ParentKeysOf`](./data-types.md#Azure.ResourceManager.ParentKeysOf) -- [`PrivateEndpoint`](./data-types.md#Azure.ResourceManager.PrivateEndpoint) -- [`PrivateEndpointConnection`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnection) -- [`PrivateEndpointConnectionParameter`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnectionParameter) -- [`PrivateEndpointConnectionProperties`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnectionProperties) - [`PrivateEndpointConnectionResourceListResult`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnectionResourceListResult) - [`PrivateLinkResource`](./data-types.md#Azure.ResourceManager.PrivateLinkResource) - [`PrivateLinkResourceListResult`](./data-types.md#Azure.ResourceManager.PrivateLinkResourceListResult) -- [`PrivateLinkResourceParameter`](./data-types.md#Azure.ResourceManager.PrivateLinkResourceParameter) - [`PrivateLinkResourceProperties`](./data-types.md#Azure.ResourceManager.PrivateLinkResourceProperties) -- [`PrivateLinkServiceConnectionState`](./data-types.md#Azure.ResourceManager.PrivateLinkServiceConnectionState) - [`ProviderNamespace`](./data-types.md#Azure.ResourceManager.ProviderNamespace) - [`ProxyResource`](./data-types.md#Azure.ResourceManager.ProxyResource) - [`ResourceGroupLocationResource`](./data-types.md#Azure.ResourceManager.ResourceGroupLocationResource) @@ -172,13 +163,48 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ResourcePlanProperty`](./data-types.md#Azure.ResourceManager.ResourcePlanProperty) - [`ResourceSkuProperty`](./data-types.md#Azure.ResourceManager.ResourceSkuProperty) - [`ResourceUriParameter`](./data-types.md#Azure.ResourceManager.ResourceUriParameter) -- [`SubscriptionIdParameter`](./data-types.md#Azure.ResourceManager.SubscriptionIdParameter) - [`SubscriptionLocationResource`](./data-types.md#Azure.ResourceManager.SubscriptionLocationResource) - [`TenantLocationResource`](./data-types.md#Azure.ResourceManager.TenantLocationResource) - [`TrackedResource`](./data-types.md#Azure.ResourceManager.TrackedResource) ## Azure.ResourceManager.CommonTypes +### Models + +- [`ApiVersionParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.ApiVersionParameter) +- [`ArmTagsProperty`](./data-types.md#Azure.ResourceManager.CommonTypes.ArmTagsProperty) +- [`AzureEntityResource`](./data-types.md#Azure.ResourceManager.CommonTypes.AzureEntityResource) +- [`CheckNameAvailabilityRequest`](./data-types.md#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest) +- [`CheckNameAvailabilityResponse`](./data-types.md#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse) +- [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption) +- [`EncryptionConfiguration`](./data-types.md#Azure.ResourceManager.CommonTypes.EncryptionConfiguration) +- [`ErrorAdditionalInfo`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo) +- [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) +- [`ExtendedLocation`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtendedLocation) +- [`ExtensionResource`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtensionResource) +- [`ManagedServiceIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity) +- [`Operation`](./data-types.md#Azure.ResourceManager.CommonTypes.Operation) +- [`OperationDisplay`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationDisplay) +- [`OperationIdParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationIdParameter) +- [`OperationListResult`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationListResult) +- [`OperationStatusResult`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationStatusResult) +- [`Plan`](./data-types.md#Azure.ResourceManager.CommonTypes.Plan) +- [`PrivateEndpoint`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpoint) +- [`PrivateEndpointConnection`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnection) +- [`PrivateEndpointConnectionParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionParameter) +- [`PrivateEndpointConnectionProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties) +- [`PrivateLinkResourceParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateLinkResourceParameter) +- [`PrivateLinkServiceConnectionState`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState) +- [`ProxyResource`](./data-types.md#Azure.ResourceManager.CommonTypes.ProxyResource) +- [`Resource`](./data-types.md#Azure.ResourceManager.CommonTypes.Resource) +- [`Sku`](./data-types.md#Azure.ResourceManager.CommonTypes.Sku) +- [`SubscriptionIdParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.SubscriptionIdParameter) +- [`SystemAssignedServiceIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity) +- [`SystemData`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemData) +- [`TrackedResource`](./data-types.md#Azure.ResourceManager.CommonTypes.TrackedResource) +- [`UserAssignedIdentities`](./data-types.md#Azure.ResourceManager.CommonTypes.UserAssignedIdentities) +- [`UserAssignedIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.UserAssignedIdentity) + ## Azure.ResourceManager.Foundations ### Operations @@ -190,41 +216,18 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager ### Models -- [`ArmTagsProperty`](./data-types.md#Azure.ResourceManager.Foundations.ArmTagsProperty) -- [`AzureEntityResource`](./data-types.md#Azure.ResourceManager.Foundations.AzureEntityResource) -- [`CheckNameAvailabilityRequest`](./data-types.md#Azure.ResourceManager.Foundations.CheckNameAvailabilityRequest) -- [`CheckNameAvailabilityResponse`](./data-types.md#Azure.ResourceManager.Foundations.CheckNameAvailabilityResponse) - [`DefaultBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.DefaultBaseParameters) -- [`ErrorAdditionalInfo`](./data-types.md#Azure.ResourceManager.Foundations.ErrorAdditionalInfo) -- [`ErrorDetail`](./data-types.md#Azure.ResourceManager.Foundations.ErrorDetail) -- [`ExtendedLocation`](./data-types.md#Azure.ResourceManager.Foundations.ExtendedLocation) - [`ExtensionBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionBaseParameters) -- [`ExtensionResource`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionResource) - [`ExtensionScope`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionScope) - [`LocationBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.LocationBaseParameters) - [`LocationScope`](./data-types.md#Azure.ResourceManager.Foundations.LocationScope) -- [`ManagedServiceIdentity`](./data-types.md#Azure.ResourceManager.Foundations.ManagedServiceIdentity) -- [`Operation`](./data-types.md#Azure.ResourceManager.Foundations.Operation) -- [`OperationDisplay`](./data-types.md#Azure.ResourceManager.Foundations.OperationDisplay) -- [`OperationIdParameter`](./data-types.md#Azure.ResourceManager.Foundations.OperationIdParameter) -- [`OperationListResult`](./data-types.md#Azure.ResourceManager.Foundations.OperationListResult) -- [`OperationStatusResult`](./data-types.md#Azure.ResourceManager.Foundations.OperationStatusResult) -- [`Plan`](./data-types.md#Azure.ResourceManager.Foundations.Plan) -- [`ProxyResource`](./data-types.md#Azure.ResourceManager.Foundations.ProxyResource) - [`ProxyResourceUpdateModel`](./data-types.md#Azure.ResourceManager.Foundations.ProxyResourceUpdateModel) -- [`Resource`](./data-types.md#Azure.ResourceManager.Foundations.Resource) - [`ResourceGroupBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.ResourceGroupBaseParameters) - [`ResourceGroupScope`](./data-types.md#Azure.ResourceManager.Foundations.ResourceGroupScope) - [`ResourceUpdateModel`](./data-types.md#Azure.ResourceManager.Foundations.ResourceUpdateModel) - [`ResourceUpdateModelProperties`](./data-types.md#Azure.ResourceManager.Foundations.ResourceUpdateModelProperties) -- [`Sku`](./data-types.md#Azure.ResourceManager.Foundations.Sku) - [`SubscriptionBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.SubscriptionBaseParameters) - [`SubscriptionScope`](./data-types.md#Azure.ResourceManager.Foundations.SubscriptionScope) -- [`SystemAssignedServiceIdentity`](./data-types.md#Azure.ResourceManager.Foundations.SystemAssignedServiceIdentity) -- [`SystemData`](./data-types.md#Azure.ResourceManager.Foundations.SystemData) - [`TagsUpdateModel`](./data-types.md#Azure.ResourceManager.Foundations.TagsUpdateModel) - [`TenantBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.TenantBaseParameters) - [`TenantScope`](./data-types.md#Azure.ResourceManager.Foundations.TenantScope) -- [`TrackedResource`](./data-types.md#Azure.ResourceManager.Foundations.TrackedResource) -- [`UserAssignedIdentities`](./data-types.md#Azure.ResourceManager.Foundations.UserAssignedIdentities) -- [`UserAssignedIdentity`](./data-types.md#Azure.ResourceManager.Foundations.UserAssignedIdentity) diff --git a/docs/libraries/azure-resource-manager/reference/interfaces.md b/docs/libraries/azure-resource-manager/reference/interfaces.md index e9faafed8d..885a7c8275 100644 --- a/docs/libraries/azure-resource-manager/reference/interfaces.md +++ b/docs/libraries/azure-resource-manager/reference/interfaces.md @@ -128,7 +128,7 @@ interface Azure.ResourceManager.Operations<> List the operations for the provider ```typespec -op Azure.ResourceManager.Operations.list(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.Operations.list(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse ``` ### `ProxyResourceOperations` {#Azure.ResourceManager.ProxyResourceOperations} diff --git a/packages/typespec-azure-resource-manager/README.md b/packages/typespec-azure-resource-manager/README.md index a539c76ec9..422c204ebf 100644 --- a/packages/typespec-azure-resource-manager/README.md +++ b/packages/typespec-azure-resource-manager/README.md @@ -94,7 +94,7 @@ This decorator is used either on a namespace or a version enum value to indicate the version of the Azure Resource Manager common-types to use for refs in emitted Swagger files. ```typespec -@Azure.ResourceManager.armCommonTypesVersion(version: valueof string | EnumMember) +@Azure.ResourceManager.armCommonTypesVersion(version: EnumMember) ``` ##### Target @@ -103,9 +103,9 @@ the version of the Azure Resource Manager common-types to use for refs in emitte ##### Parameters -| Name | Type | Description | -| ------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -| version | `valueof string \| EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version or an equivalent string value. | +| Name | Type | Description | +| ------- | ------------ | ------------------------------------------------------------------------------------ | +| version | `EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. | #### `@armLibraryNamespace` From f397315423259ba8a4dd9434021aacee5fa4cbb3 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 31 May 2024 18:41:27 -0700 Subject: [PATCH 07/25] Fixing formating --- .../typespec-azure-resource-manager/scripts/common-types.tsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typespec-azure-resource-manager/scripts/common-types.tsp b/packages/typespec-azure-resource-manager/scripts/common-types.tsp index ba73dc893a..6410540c11 100644 --- a/packages/typespec-azure-resource-manager/scripts/common-types.tsp +++ b/packages/typespec-azure-resource-manager/scripts/common-types.tsp @@ -10,7 +10,7 @@ using TypeSpec.Versioning; using TypeSpec.OpenAPI; @versioned(Azure.ResourceManager.Foundations.Versions) -@service() +@service namespace Azure.ResourceManager.Foundations; /** From 3cb79c8fb480421729403854209f4f33b7d78b28 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 31 May 2024 21:53:38 -0700 Subject: [PATCH 08/25] Fixing linting & test cases --- .../typespec-autorest/test/arm/arm.test.ts | 1 + .../test/decorators.test.ts | 2 ++ .../scripts/generate-common-types.js | 23 ---------------- .../src/namespace.ts | 27 ++++++++++--------- .../src/private.decorators.ts | 4 --- 5 files changed, 18 insertions(+), 39 deletions(-) delete mode 100644 packages/typespec-azure-resource-manager/scripts/generate-common-types.js diff --git a/packages/typespec-autorest/test/arm/arm.test.ts b/packages/typespec-autorest/test/arm/arm.test.ts index 39513d75f0..b1c91404d2 100644 --- a/packages/typespec-autorest/test/arm/arm.test.ts +++ b/packages/typespec-autorest/test/arm/arm.test.ts @@ -69,6 +69,7 @@ it("can share types with a library namespace", async () => { it("can use private links with common-types references", async () => { const openapi = await openApiFor( `@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) @armProviderNamespace namespace Microsoft.PrivateLinkTest; diff --git a/packages/typespec-azure-portal-core/test/decorators.test.ts b/packages/typespec-azure-portal-core/test/decorators.test.ts index 91cd9a37d3..41390cfe3f 100644 --- a/packages/typespec-azure-portal-core/test/decorators.test.ts +++ b/packages/typespec-azure-portal-core/test/decorators.test.ts @@ -296,10 +296,12 @@ export function createTestSpec( enum Versions { @useDependency(Azure.Core.Versions.v1_0_Preview_2) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) v2022_09_02_preview: "2022-09-02-preview", @useDependency(Azure.Core.Versions.v1_0_Preview_2) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) v2024_02_20_preview: "2024-02-20-preview", } diff --git a/packages/typespec-azure-resource-manager/scripts/generate-common-types.js b/packages/typespec-azure-resource-manager/scripts/generate-common-types.js deleted file mode 100644 index 26338d39f4..0000000000 --- a/packages/typespec-azure-resource-manager/scripts/generate-common-types.js +++ /dev/null @@ -1,23 +0,0 @@ -async function generateCommonTypesSwagger(packages) { - const basicLatestDir = join(e2eTestDir, "basic-latest"); - const outputDir = join(basicLatestDir, "tsp-output"); - console.log("Clearing basic-latest output"); - rmSync(outputDir, { recursive: true, force: true }); - console.log("Cleared basic-latest output"); - - console.log("Installing basic-latest dependencies"); - await runTypeSpec(packages["@typespec/compiler"], ["install"], { cwd: basicLatestDir }); - console.log("Installed basic-latest dependencies"); - - console.log("Running tsp compile ."); - await runTypeSpec( - packages["@typespec/compiler"], - ["compile", ".", "--emit", "@typespec/openapi3"], - { - cwd: basicLatestDir, - } - ); - console.log("Completed tsp compile ."); - - expectOpenApiOutput(outputDir); -} diff --git a/packages/typespec-azure-resource-manager/src/namespace.ts b/packages/typespec-azure-resource-manager/src/namespace.ts index a4e646cd3b..802d0f3da2 100644 --- a/packages/typespec-azure-resource-manager/src/namespace.ts +++ b/packages/typespec-azure-resource-manager/src/namespace.ts @@ -13,11 +13,18 @@ import { import * as http from "@typespec/http"; import { getAuthentication, setAuthentication, setRouteOptionsForNamespace } from "@typespec/http"; import { getResourceTypeForKeyParam } from "@typespec/rest"; +import { $useDependency } from "@typespec/versioning"; import { $armCommonTypesVersion } from "./common-types.js"; import { reportDiagnostic } from "./lib.js"; import { getSingletonResourceKey } from "./resource.js"; import { ArmStateKeys } from "./state.js"; +function getArmCommonTypeV3Enum(context: DecoratorContext): EnumMember { + return context.program.resolveTypeReference( + "Azure.ResourceManager.CommonTypes.Versions.v3" + )[0] as EnumMember; +} + /** * Mark the target namespace as containign only ARM library types. This is used to create libraries to share among RPs * @param context The doecorator context, automatically supplied by the compiler @@ -31,6 +38,7 @@ export function $armLibraryNamespace(context: DecoratorContext, entity: Namespac __unsupported_enable_checkStandardOperations(false); program.stateMap(ArmStateKeys.armLibraryNamespaces).set(entity, true); + context.call($useDependency, entity, getArmCommonTypeV3Enum(context)); } /** @@ -131,18 +139,13 @@ export function $armProviderNamespace( } // Determine whether to set a default ARM CommonTypes.Version - const v3EnumMember = context.program.resolveTypeReference( - "Azure.ResourceManager.CommonTypes.Versions.v3" - )[0] as EnumMember; - if (v3EnumMember) { - const armCommonTypesVersion = entity.decorators.find( - (x) => x.definition?.name === "@armCommonTypesVersion" - ); - // if no existing @armCommonTypesVersion decorator, add default. - // This will NOT cause error if overrode on version enum. - if (!armCommonTypesVersion) { - context.call($armCommonTypesVersion, entity, v3EnumMember); - } + const armCommonTypesVersion = entity.decorators.find( + (x) => x.definition?.name === "@armCommonTypesVersion" + ); + // if no existing @armCommonTypesVersion decorator, add default. + // This will NOT cause error if overrode on version enum. + if (!armCommonTypesVersion) { + context.call($armCommonTypesVersion, entity, getArmCommonTypeV3Enum(context)); } // 'namespace' is optional, use the actual namespace string if omitted diff --git a/packages/typespec-azure-resource-manager/src/private.decorators.ts b/packages/typespec-azure-resource-manager/src/private.decorators.ts index cd829d7d01..39afe7bc27 100644 --- a/packages/typespec-azure-resource-manager/src/private.decorators.ts +++ b/packages/typespec-azure-resource-manager/src/private.decorators.ts @@ -156,10 +156,6 @@ function isResourceParameterBaseForInternal( return false; } -function getArmTypesPath(program: Program): string { - return program.getOption("arm-types-path") || "{arm-types-dir}"; -} - /** * This decorator dynamically assigns the serviceNamespace from the containing * namespace to the string literal value of the path parameter to which this From f08932e006e34c6fbc950fd94d1c800d332de6fb Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 4 Jun 2024 16:12:18 -0700 Subject: [PATCH 09/25] Added back string support and additional cases --- .../lib/decorators.tsp | 5 +- .../src/common-types.ts | 55 +++++++++++++++-- .../src/lib.ts | 6 ++ .../src/namespace.ts | 59 ++++++++++++++----- 4 files changed, 106 insertions(+), 19 deletions(-) diff --git a/packages/typespec-azure-resource-manager/lib/decorators.tsp b/packages/typespec-azure-resource-manager/lib/decorators.tsp index ad954c60b4..2781366d97 100644 --- a/packages/typespec-azure-resource-manager/lib/decorators.tsp +++ b/packages/typespec-azure-resource-manager/lib/decorators.tsp @@ -182,7 +182,10 @@ extern dec armResourceOperations(target: Interface, _?: unknown); * * @param version The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. */ -extern dec armCommonTypesVersion(target: Namespace | EnumMember, version: EnumMember); +extern dec armCommonTypesVersion( + target: Namespace | EnumMember, + version: valueof string | EnumMember +); /** * This decorator is used on Azure Resource Manager resources that are not based on diff --git a/packages/typespec-azure-resource-manager/src/common-types.ts b/packages/typespec-azure-resource-manager/src/common-types.ts index 2b86a05134..8b69d3bf93 100644 --- a/packages/typespec-azure-resource-manager/src/common-types.ts +++ b/packages/typespec-azure-resource-manager/src/common-types.ts @@ -3,6 +3,7 @@ import { Diagnostic, Enum, EnumMember, + EnumValue, Model, ModelProperty, Namespace, @@ -25,13 +26,42 @@ export interface ArmCommonTypeVersions { allVersions: EnumMember[]; } -export function getArmCommonTypesVersions(program: Program): ArmCommonTypeVersions | undefined { +export function getArmCommonTypesVersions(program: Program): ArmCommonTypeVersions { // There is a single instance of ArmCommonTypeVersions stored inside of the // state map so just pull the first (only) item from the map. const map: Map = program.stateMap(ArmStateKeys.armCommonTypesVersions); return map?.values().next().value as any; } +export function getArmCommonTypesVersionFromString( + program: Program, + entity: Namespace | EnumMember, + versionStr: string +): [EnumMember | undefined, readonly Diagnostic[]] { + const commonTypeVersionEnum = program.resolveTypeReference( + `Azure.ResourceManager.CommonTypes.Versions.${versionStr}` + )[0] as EnumMember; + if (commonTypeVersionEnum === undefined) { + return [ + undefined, + [ + createDiagnostic({ + code: "arm-common-types-invalid-version", + target: entity, + format: { + versionString: versionStr, + supportedVersions: [...getArmCommonTypesVersions(program).type.members.keys()].join( + ", " + ), + }, + }), + ], + ]; + } else { + return [commonTypeVersionEnum, []]; + } +} + /** * Check if a given model or model property is an ARM common type. * @param {Type} entity - The entity to be checked. @@ -55,9 +85,26 @@ export function isArmCommonType(entity: Type): boolean { export function $armCommonTypesVersion( context: DecoratorContext, entity: Namespace | EnumMember, - version: EnumMember + version: string | EnumValue ) { - context.program.stateMap(ArmStateKeys.armCommonTypesVersion).set(entity, version.name as string); + // try convert string to EnumMember + let versionEnum: EnumMember; + if (typeof version === "string") { + const [foundEnumMember, diagnostics] = getArmCommonTypesVersionFromString( + context.program, + entity, + version + ); + if (!foundEnumMember) { + context.program.reportDiagnostics(diagnostics); + return; + } + versionEnum = foundEnumMember as EnumMember; + } else { + versionEnum = version.value; + } + + context.program.stateMap(ArmStateKeys.armCommonTypesVersion).set(entity, versionEnum.name); if (entity.kind === "Namespace") { const versioned = entity.decorators.find((x) => x.definition?.name === "@versioned"); @@ -67,7 +114,7 @@ export function $armCommonTypesVersion( } } // Add @useDependency on version enum members or on unversioned namespace - context.call($useDependency, entity, version); + context.call($useDependency, entity, versionEnum); } /** diff --git a/packages/typespec-azure-resource-manager/src/lib.ts b/packages/typespec-azure-resource-manager/src/lib.ts index 4ba733df3b..141c9aa66b 100644 --- a/packages/typespec-azure-resource-manager/src/lib.ts +++ b/packages/typespec-azure-resource-manager/src/lib.ts @@ -76,6 +76,12 @@ export const $lib = createTypeSpecLibrary({ default: paramMessage`No ARM common-types version for this type satisfies the expected version ${"selectedVersion"}. This type only supports the following version(s): ${"supportedVersions"}`, }, }, + "arm-common-types-invalid-version": { + severity: "error", + messages: { + default: paramMessage`No ARM common-types version match the version string ${"versionString"}. The following versions are supported: ${"supportedVersions"}`, + }, + }, "decorator-in-namespace": { severity: "error", messages: { diff --git a/packages/typespec-azure-resource-manager/src/namespace.ts b/packages/typespec-azure-resource-manager/src/namespace.ts index 802d0f3da2..b091b908e6 100644 --- a/packages/typespec-azure-resource-manager/src/namespace.ts +++ b/packages/typespec-azure-resource-manager/src/namespace.ts @@ -1,7 +1,9 @@ import { __unsupported_enable_checkStandardOperations } from "@azure-tools/typespec-azure-core"; import { DecoratorContext, + Enum, EnumMember, + EnumValue, Model, ModelProperty, Namespace, @@ -13,16 +15,33 @@ import { import * as http from "@typespec/http"; import { getAuthentication, setAuthentication, setRouteOptionsForNamespace } from "@typespec/http"; import { getResourceTypeForKeyParam } from "@typespec/rest"; -import { $useDependency } from "@typespec/versioning"; import { $armCommonTypesVersion } from "./common-types.js"; import { reportDiagnostic } from "./lib.js"; import { getSingletonResourceKey } from "./resource.js"; import { ArmStateKeys } from "./state.js"; -function getArmCommonTypeV3Enum(context: DecoratorContext): EnumMember { - return context.program.resolveTypeReference( - "Azure.ResourceManager.CommonTypes.Versions.v3" - )[0] as EnumMember; +function getArmCommonTypesVersion( + context: DecoratorContext, + entity: Namespace | EnumMember +): EnumValue | undefined { + return entity.decorators.find((x) => x.definition?.name === "@armCommonTypesVersion")?.args[0] + .jsValue as EnumValue | undefined; +} + +function setArmCommonTypesVersionIfDoesnotExist( + context: DecoratorContext, + entity: Namespace | EnumMember, + commonTypeVersion: string +) { + // Determine whether to set a default ARM CommonTypes.Version + const armCommonTypesVersion = entity.decorators.find( + (x) => x.definition?.name === "@armCommonTypesVersion" + ); + // if no existing @armCommonTypesVersion decorator, add default. + // This will NOT cause error if overrode on version enum. + if (!armCommonTypesVersion) { + context.call($armCommonTypesVersion, entity, commonTypeVersion); + } } /** @@ -38,7 +57,8 @@ export function $armLibraryNamespace(context: DecoratorContext, entity: Namespac __unsupported_enable_checkStandardOperations(false); program.stateMap(ArmStateKeys.armLibraryNamespaces).set(entity, true); - context.call($useDependency, entity, getArmCommonTypeV3Enum(context)); + + setArmCommonTypesVersionIfDoesnotExist(context, entity, "v3"); } /** @@ -138,14 +158,25 @@ export function $armProviderNamespace( } } - // Determine whether to set a default ARM CommonTypes.Version - const armCommonTypesVersion = entity.decorators.find( - (x) => x.definition?.name === "@armCommonTypesVersion" - ); - // if no existing @armCommonTypesVersion decorator, add default. - // This will NOT cause error if overrode on version enum. - if (!armCommonTypesVersion) { - context.call($armCommonTypesVersion, entity, getArmCommonTypeV3Enum(context)); + const armCommonTypesVersion = getArmCommonTypesVersion(context, entity); + + // If it is versioned namespace, we will check each Version enum member. If no + // @armCommonTypeVersion decorator, add the one + const versioned = entity.decorators.find((x) => x.definition?.name === "@versioned"); + if (versioned) { + const versionEnum = versioned.args[0].value as Enum; + versionEnum.members.forEach((v) => { + if (!getArmCommonTypesVersion(context, v)) { + context.call($armCommonTypesVersion, entity, armCommonTypesVersion ?? "v3"); + } + }); + } else { + // if it is unversioned namespace, set @armCommonTypesVersion and + // no existing @armCommonTypesVersion decorator, add default. + // This will NOT cause error if overrode on version enum. + if (!armCommonTypesVersion) { + context.call($armCommonTypesVersion, entity, "v3"); + } } // 'namespace' is optional, use the actual namespace string if omitted From 4c00146224f1d636acf90b08dc67d4294256c6ef Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 4 Jun 2024 18:03:29 -0700 Subject: [PATCH 10/25] Update docs --- .../azure-resource-manager/reference/decorators.md | 8 ++++---- packages/typespec-azure-resource-manager/README.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/libraries/azure-resource-manager/reference/decorators.md b/docs/libraries/azure-resource-manager/reference/decorators.md index 5f7b56e4a6..ee1d42158a 100644 --- a/docs/libraries/azure-resource-manager/reference/decorators.md +++ b/docs/libraries/azure-resource-manager/reference/decorators.md @@ -14,7 +14,7 @@ This decorator is used either on a namespace or a version enum value to indicate the version of the Azure Resource Manager common-types to use for refs in emitted Swagger files. ```typespec -@Azure.ResourceManager.armCommonTypesVersion(version: EnumMember) +@Azure.ResourceManager.armCommonTypesVersion(version: valueof string | EnumMember) ``` #### Target @@ -23,9 +23,9 @@ the version of the Azure Resource Manager common-types to use for refs in emitte #### Parameters -| Name | Type | Description | -| ------- | ------------ | ------------------------------------------------------------------------------------ | -| version | `EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. | +| Name | Type | Description | +| ------- | ------------------------------ | ------------------------------------------------------------------------------------ | +| version | `valueof string \| EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. | ### `@armLibraryNamespace` {#@Azure.ResourceManager.armLibraryNamespace} diff --git a/packages/typespec-azure-resource-manager/README.md b/packages/typespec-azure-resource-manager/README.md index 422c204ebf..5c1b20fd24 100644 --- a/packages/typespec-azure-resource-manager/README.md +++ b/packages/typespec-azure-resource-manager/README.md @@ -94,7 +94,7 @@ This decorator is used either on a namespace or a version enum value to indicate the version of the Azure Resource Manager common-types to use for refs in emitted Swagger files. ```typespec -@Azure.ResourceManager.armCommonTypesVersion(version: EnumMember) +@Azure.ResourceManager.armCommonTypesVersion(version: valueof string | EnumMember) ``` ##### Target @@ -103,9 +103,9 @@ the version of the Azure Resource Manager common-types to use for refs in emitte ##### Parameters -| Name | Type | Description | -| ------- | ------------ | ------------------------------------------------------------------------------------ | -| version | `EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. | +| Name | Type | Description | +| ------- | ------------------------------ | ------------------------------------------------------------------------------------ | +| version | `valueof string \| EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. | #### `@armLibraryNamespace` From b32b87af99a532868de214bff6f73dbf588ea31a Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 4 Jun 2024 19:22:40 -0700 Subject: [PATCH 11/25] Correctly apply commonType to version enum member. --- packages/typespec-azure-resource-manager/src/namespace.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typespec-azure-resource-manager/src/namespace.ts b/packages/typespec-azure-resource-manager/src/namespace.ts index b091b908e6..4ea6b15449 100644 --- a/packages/typespec-azure-resource-manager/src/namespace.ts +++ b/packages/typespec-azure-resource-manager/src/namespace.ts @@ -167,7 +167,7 @@ export function $armProviderNamespace( const versionEnum = versioned.args[0].value as Enum; versionEnum.members.forEach((v) => { if (!getArmCommonTypesVersion(context, v)) { - context.call($armCommonTypesVersion, entity, armCommonTypesVersion ?? "v3"); + context.call($armCommonTypesVersion, v, armCommonTypesVersion ?? "v3"); } }); } else { From 9c527ed822fc7aef0cab938e0796b809656929f3 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 4 Jun 2024 20:57:14 -0700 Subject: [PATCH 12/25] Reenable armCommonType check by checking decorator instead of stateMap --- .../src/rules/arm-common-types-version.ts | 12 +++++-- .../rules/arm-common-types-version.test.ts | 36 +++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/packages/typespec-azure-resource-manager/src/rules/arm-common-types-version.ts b/packages/typespec-azure-resource-manager/src/rules/arm-common-types-version.ts index dc3b262185..0da4458e1c 100644 --- a/packages/typespec-azure-resource-manager/src/rules/arm-common-types-version.ts +++ b/packages/typespec-azure-resource-manager/src/rules/arm-common-types-version.ts @@ -1,7 +1,6 @@ import { Program, SemanticNodeListener, createRule } from "@typespec/compiler"; import { getAllHttpServices } from "@typespec/http"; import { getVersion } from "@typespec/versioning"; -import { getArmCommonTypesVersion } from "../common-types.js"; import { getArmProviderNamespace } from "../namespace.js"; /** @@ -34,9 +33,16 @@ export const armCommonTypesVersionRule = createRule({ versionMap && versionMap .getVersions() - .every((version) => !!getArmCommonTypesVersion(program, version.enumMember)) + .every( + (version) => + !!version.enumMember.decorators.find( + (x) => x.definition?.name === "@armCommonTypesVersion" + ) + ) ) && - !getArmCommonTypesVersion(program, service.namespace) + !service.namespace.decorators.find( + (x) => x.definition?.name === "@armCommonTypesVersion" + ) ) { context.reportDiagnostic({ target: service.namespace, diff --git a/packages/typespec-azure-resource-manager/test/rules/arm-common-types-version.test.ts b/packages/typespec-azure-resource-manager/test/rules/arm-common-types-version.test.ts index c8ea033143..745d981329 100644 --- a/packages/typespec-azure-resource-manager/test/rules/arm-common-types-version.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/arm-common-types-version.test.ts @@ -20,6 +20,42 @@ describe("typespec-azure-resource-manager: ARM common-types version rule", () => ); }); + it("emits diagnostic when a version in the enum is missing a common type version", async () => { + await tester + .expect( + ` + @service({ title: "Test" }) + @versioned(Service.Versions) + @armProviderNamespace("Contoso.Service") + namespace Service; + + enum Versions { + v1; + + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) + v2; + } + ` + ) + .toEmitDiagnostics({ + code: "@azure-tools/typespec-azure-resource-manager/arm-common-types-version", + }); + }); + + it("emits diagnostic when unversioned service namespace is missing a common type version", async () => { + await tester + .expect( + ` + @service({ title: "Test" }) + @armProviderNamespace("Contoso.Service") + namespace Service; + ` + ) + .toEmitDiagnostics({ + code: "@azure-tools/typespec-azure-resource-manager/arm-common-types-version", + }); + }); + it("does not emit when the service namespace has a common type version without version on enum values", async () => { await tester .expect( From 49bd8aa4b5232546fcca058ed1d255e59d3621f8 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 4 Jun 2024 22:06:11 -0700 Subject: [PATCH 13/25] PR Comment --- .../lib/backcompat.tsp | 34 +++++++++---------- .../scripts/common-types.tsp | 29 ---------------- .../test/rules/retry-after.test.ts | 4 +-- 3 files changed, 18 insertions(+), 49 deletions(-) delete mode 100644 packages/typespec-azure-resource-manager/scripts/common-types.tsp diff --git a/packages/typespec-azure-resource-manager/lib/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/backcompat.tsp index 9612fff99e..ca31b574bd 100644 --- a/packages/typespec-azure-resource-manager/lib/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/backcompat.tsp @@ -1,20 +1,20 @@ using Azure.ResourceManager.CommonTypes; -namespace Azure.ResourceManager { - // customer-managed-keys - alias InfrastructureEncryption = CommonTypes.InfrastructureEncryption; - alias KeyEncryptionIdentity = CommonTypes.KeyEncryptionKeyIdentity; - alias KeyEncryptionKeyIdentity = CommonTypes.KeyEncryptionKeyIdentity; - alias CustomerManagedKeyEncryption = CommonTypes.CustomerManagedKeyEncryption; - alias EncryptionConfiguration = CommonTypes.EncryptionConfiguration; +namespace Azure.ResourceManager; - // private-links - alias PrivateEndpoint = CommonTypes.PrivateEndpoint; - alias PrivateEndpointConnection = CommonTypes.PrivateEndpointConnection; - alias PrivateEndpointConnectionProperties = CommonTypes.PrivateEndpointConnectionProperties; - alias PrivateLinkServiceConnectionState = CommonTypes.PrivateLinkServiceConnectionState; - alias PrivateEndpointConnectionProvisioningState = CommonTypes.PrivateEndpointConnectionProvisioningState; - alias PrivateEndpointServiceConnectionStatus = CommonTypes.PrivateEndpointServiceConnectionStatus; - alias PrivateEndpointConnectionParameter = CommonTypes.PrivateEndpointConnectionParameter; - alias PrivateLinkResourceParameter = CommonTypes.PrivateLinkResourceParameter; -} +// customer-managed-keys +alias InfrastructureEncryption = CommonTypes.InfrastructureEncryption; +alias KeyEncryptionIdentity = CommonTypes.KeyEncryptionKeyIdentity; +alias KeyEncryptionKeyIdentity = CommonTypes.KeyEncryptionKeyIdentity; +alias CustomerManagedKeyEncryption = CommonTypes.CustomerManagedKeyEncryption; +alias EncryptionConfiguration = CommonTypes.EncryptionConfiguration; + +// private-links +alias PrivateEndpoint = CommonTypes.PrivateEndpoint; +alias PrivateEndpointConnection = CommonTypes.PrivateEndpointConnection; +alias PrivateEndpointConnectionProperties = CommonTypes.PrivateEndpointConnectionProperties; +alias PrivateLinkServiceConnectionState = CommonTypes.PrivateLinkServiceConnectionState; +alias PrivateEndpointConnectionProvisioningState = CommonTypes.PrivateEndpointConnectionProvisioningState; +alias PrivateEndpointServiceConnectionStatus = CommonTypes.PrivateEndpointServiceConnectionStatus; +alias PrivateEndpointConnectionParameter = CommonTypes.PrivateEndpointConnectionParameter; +alias PrivateLinkResourceParameter = CommonTypes.PrivateLinkResourceParameter; diff --git a/packages/typespec-azure-resource-manager/scripts/common-types.tsp b/packages/typespec-azure-resource-manager/scripts/common-types.tsp deleted file mode 100644 index 6410540c11..0000000000 --- a/packages/typespec-azure-resource-manager/scripts/common-types.tsp +++ /dev/null @@ -1,29 +0,0 @@ -import "@typespec/openapi"; -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; - -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using TypeSpec.OpenAPI; - -@versioned(Azure.ResourceManager.Foundations.Versions) -@service -namespace Azure.ResourceManager.Foundations; - -/** - * Supported versions of Azure.ResourceManager building blocks. - */ -@doc("Supported versions of Azure.ResourceManager building blocks.") -enum Versions { - @doc("ARM common types v3") - v3, - - @doc("ARM common types v3") - v4, - - @doc("ARM common types v3") - v5, -} diff --git a/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts b/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts index af9959e975..36fb856064 100644 --- a/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/retry-after.test.ts @@ -24,9 +24,7 @@ describe("typespec-azure-resource-manager: retry-after rule", () => { await tester .expect( ` - @service({ - title: "Microsoft.Foo", - }) + @service @armProviderNamespace @versioned(Versions) namespace Microsoft.Foo; From 2398020aed55a49e4399d4ebf01a77361be72a4b Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 7 Jun 2024 00:20:36 -0700 Subject: [PATCH 14/25] Synced with common-type swagger --- .../reference/data-types.md | 625 ++++++++++++------ .../reference/index.mdx | 27 +- .../reference/interfaces.md | 112 ++-- .../lib/backcompat.tsp | 7 +- .../customer-managed-keys-ref.tsp | 8 +- .../common-types/customer-managed-keys.tsp | 44 +- .../lib/common-types/internal.tsp | 3 + .../lib/common-types/managed-identity.tsp | 85 ++- .../lib/common-types/private-links-ref.tsp | 11 + .../lib/common-types/private-links.tsp | 78 ++- .../lib/common-types/types-ref.tsp | 27 + .../lib/common-types/types.tsp | 316 ++++++--- .../lib/foundations/arm.foundations.tsp | 11 + .../lib/foundations/backcompat.tsp | 1 - .../lib/models.tsp | 34 - .../lib/responses.tsp | 13 - .../test/rules/core-operations.test.ts | 2 + 17 files changed, 906 insertions(+), 498 deletions(-) diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index 64361d4daf..6cbdb8f500 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -406,9 +406,9 @@ model Foo is TrackedResource { #### Properties -| Name | Type | Description | -| ---------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------- | -| encryption | [`EncryptionConfiguration`](./data-types.md#Azure.ResourceManager.CommonTypes.EncryptionConfiguration) | All encryption configuration for a resource. | +| Name | Type | Description | +| ---------- | ---------------------------------------------------------------------------- | -------------------------------------------- | +| encryption | [`Encryption`](./data-types.md#Azure.ResourceManager.CommonTypes.Encryption) | All encryption configuration for a resource. | ### `EntityTagProperty` {#Azure.ResourceManager.EntityTagProperty} @@ -433,20 +433,6 @@ model Foo is TrackedResource { | ----- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | eTag? | `string` | If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. | -### `ErrorResponse` {#Azure.ResourceManager.ErrorResponse} - -The standard Azure Resource Manager error response - -```typespec -model Azure.ResourceManager.ErrorResponse -``` - -#### Properties - -| Name | Type | Description | -| ------ | ------------------------------------------------------------------------------ | ----------------- | -| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) | The error object. | - ### `ExtendedLocationProperty` {#Azure.ResourceManager.ExtendedLocationProperty} Model representing the standard `extendedLocation` envelope property for a resource. @@ -631,62 +617,6 @@ model Azure.ResourceManager.ParentKeysOf None -### `PrivateEndpointConnectionResourceListResult` {#Azure.ResourceManager.PrivateEndpointConnectionResourceListResult} - -List of private endpoint connections associated with the specified resource. - -```typespec -model Azure.ResourceManager.PrivateEndpointConnectionResourceListResult -``` - -#### Properties - -| Name | Type | Description | -| ------ | --------------------------------------------------------- | ------------------------------------- | -| value? | `ResourceManager.CommonTypes.PrivateEndpointConnection[]` | Array of private endpoint connections | - -### `PrivateLinkResource` {#Azure.ResourceManager.PrivateLinkResource} - -```typespec -model Azure.ResourceManager.PrivateLinkResource -``` - -#### Properties - -| Name | Type | Description | -| ----------- | ------------------------------------------------------------------------------------------------------ | ---------------------------------------- | -| properties? | [`PrivateLinkResourceProperties`](./data-types.md#Azure.ResourceManager.PrivateLinkResourceProperties) | Properties of the private link resource. | - -### `PrivateLinkResourceListResult` {#Azure.ResourceManager.PrivateLinkResourceListResult} - -A list of private link resources. - -```typespec -model Azure.ResourceManager.PrivateLinkResourceListResult -``` - -#### Properties - -| Name | Type | Description | -| ------ | --------------------------------------- | ------------------------------- | -| value? | `ResourceManager.PrivateLinkResource[]` | Array of private link resources | - -### `PrivateLinkResourceProperties` {#Azure.ResourceManager.PrivateLinkResourceProperties} - -Properties of a private link resource. - -```typespec -model Azure.ResourceManager.PrivateLinkResourceProperties -``` - -#### Properties - -| Name | Type | Description | -| ------------------ | ---------- | ----------------------------------------------------- | -| groupId? | `string` | The private link resource group id. | -| requiredMembers? | `string[]` | The private link resource required member names. | -| requiredZoneNames? | `string[]` | The private link resource private link DNS zone name. | - ### `ProviderNamespace` {#Azure.ResourceManager.ProviderNamespace} Model describing the provider namespace. @@ -1031,23 +961,6 @@ model Azure.ResourceManager.CommonTypes.ApiVersionParameter | ---------- | -------- | ------------------------------------------ | | apiVersion | `string` | The API version to use for this operation. | -### `ArmTagsProperty` {#Azure.ResourceManager.CommonTypes.ArmTagsProperty} - -Standard type definition for Azure Resource Manager Tags property. - -It is included in the TrackedResource template definition. -The Azure Resource Manager Resource tags. - -```typespec -model Azure.ResourceManager.CommonTypes.ArmTagsProperty -``` - -#### Properties - -| Name | Type | Description | -| ----- | ---------------- | -------------- | -| tags? | `Record` | Resource tags. | - ### `AzureEntityResource` {#Azure.ResourceManager.CommonTypes.AzureEntityResource} The resource model definition for an Azure Resource Manager resource with an etag. @@ -1058,13 +971,12 @@ model Azure.ResourceManager.CommonTypes.AzureEntityResource #### Properties -| Name | Type | Description | -| ---- | -------- | -------------- | -| etag | `string` | Resource Etag. | +| Name | Type | Description | +| ----- | -------- | -------------- | +| etag? | `string` | Resource Etag. | ### `CheckNameAvailabilityRequest` {#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest} -The check availability request body. The check availability request body. ```typespec @@ -1080,7 +992,6 @@ model Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest ### `CheckNameAvailabilityResponse` {#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse} -The check availability result. The check availability result. ```typespec @@ -1105,32 +1016,43 @@ model Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption #### Properties -| Name | Type | Description | -| ------------------------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| keyEncryptionKeyIdentity? | [`KeyEncryptionKeyIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity) | The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. | -| userAssignedIdentityResourceId? | `Core.armResourceIdentifier` | User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. | -| federatedClientId? | `Core.uuid` | application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540 | -| delegatedIdentityClientId? | `Core.uuid` | delegated identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity and userAssignedIdentity - internal use only. | +| Name | Type | Description | +| ------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| keyEncryptionKeyIdentity? | [`KeyEncryptionKeyIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity) | All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. | +| keyEncryptionKeyUrl? | `string` | key encryption key Url, versioned or non-versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. | -### `EncryptionConfiguration` {#Azure.ResourceManager.CommonTypes.EncryptionConfiguration} +### `Encryption` {#Azure.ResourceManager.CommonTypes.Encryption} -All encryption configuration for a resource. +(Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled. + +```typespec +model Azure.ResourceManager.CommonTypes.Encryption +``` + +#### Properties + +| Name | Type | Description | +| ----------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | +| infrastructureEncryption? | [`InfrastructureEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.InfrastructureEncryption) | Values are enabled and disabled. | +| customerManagedKeyEncryption? | [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption) | All Customer-managed key encryption properties for the resource. | + +### `encryptionProperties` {#Azure.ResourceManager.CommonTypes.encryptionProperties} + +Configuration of key for data encryption ```typespec -model Azure.ResourceManager.CommonTypes.EncryptionConfiguration +model Azure.ResourceManager.CommonTypes.encryptionProperties ``` #### Properties -| Name | Type | Description | -| ----------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| infrastructureEncryption? | [`InfrastructureEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.InfrastructureEncryption) | Indicates if infrastructure encryption is enabled or disabled. | -| customerManagedKeyEncryption? | [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption) | All customer-managed key encryption properties for the resource. | -| keyEncryptionKeyUrl? | `string` | key encryption key Url, versioned or unversioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. | +| Name | Type | Description | +| ------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| status? | [`EncryptionStatus`](./data-types.md#Azure.ResourceManager.CommonTypes.EncryptionStatus) | Indicates whether or not the encryption is enabled for container registry. | +| keyVaultProperties? | [`KeyVaultProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyVaultProperties) | Key vault properties. | ### `ErrorAdditionalInfo` {#Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo} -The resource management error additional info. The resource management error additional info. ```typespec @@ -1146,7 +1068,6 @@ model Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo ### `ErrorDetail` {#Azure.ResourceManager.CommonTypes.ErrorDetail} -The error detail. The error detail. ```typespec @@ -1163,6 +1084,20 @@ model Azure.ResourceManager.CommonTypes.ErrorDetail | details? | `ResourceManager.CommonTypes.ErrorDetail[]` | The error details. | | additionalInfo? | `ResourceManager.CommonTypes.ErrorAdditionalInfo[]` | The error additional info. | +### `ErrorResponse` {#Azure.ResourceManager.CommonTypes.ErrorResponse} + +Common error response for all Azure Resource Manager APIs to return error details for failed operations. + +```typespec +model Azure.ResourceManager.CommonTypes.ErrorResponse +``` + +#### Properties + +| Name | Type | Description | +| ------ | ------------------------------------------------------------------------------ | ----------------- | +| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) | The error object. | + ### `ExtendedLocation` {#Azure.ResourceManager.CommonTypes.ExtendedLocation} The complex type of the extended location. @@ -1180,7 +1115,6 @@ model Azure.ResourceManager.CommonTypes.ExtendedLocation ### `ExtensionResource` {#Azure.ResourceManager.CommonTypes.ExtensionResource} -The base extension resource. The base extension resource. ```typespec @@ -1191,9 +1125,116 @@ model Azure.ResourceManager.CommonTypes.ExtensionResource None +### `Identity` {#Azure.ResourceManager.CommonTypes.Identity} + +Identity for the resource. + +```typespec +model Azure.ResourceManager.CommonTypes.Identity +``` + +#### Properties + +| Name | Type | Description | +| -------------- | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- | +| principalIdV3? | `string` | The principal ID of resource identity. | +| principalId? | `Core.uuid` | The principal ID of resource identity. The value must be an UUID. | +| tenantIdV3? | `string` | The tenant ID of resource. | +| tenantId? | `Core.uuid` | The tenant ID of resource. The value must be an UUID. | +| type? | [`ResourceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.ResourceIdentityType) | The identity type. | + +### `IfMatchHeader` {#Azure.ResourceManager.CommonTypes.IfMatchHeader} + +The default ARM If-Match header type. + +```typespec +model Azure.ResourceManager.CommonTypes.IfMatchHeader +``` + +#### Properties + +| Name | Type | Description | +| ------- | -------- | ----------------------------------------------------- | +| ifMatch | `string` | The If-Match header that makes a request conditional. | + +### `IfNoneMatchHeader` {#Azure.ResourceManager.CommonTypes.IfNoneMatchHeader} + +The default ARM If-Match header type. + +```typespec +model Azure.ResourceManager.CommonTypes.IfNoneMatchHeader +``` + +#### Properties + +| Name | Type | Description | +| ----------- | -------- | ---------------------------------------------------------- | +| ifNoneMatch | `string` | The If-None-Match header that makes a request conditional. | + +### `KeyEncryptionKeyIdentity` {#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity} + +All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. + +```typespec +model Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity +``` + +#### Properties + +| Name | Type | Description | +| ------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| identityType? | [`KeyEncryptionKeyIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentityType) | The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. | +| userAssignedIdentityResourceId? | `Core.armResourceIdentifier` | User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. | +| federatedClientId? | `Core.uuid` | application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540 | +| delegatedIdentityClientId? | `Core.uuid` | delegated identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity and userAssignedIdentity - internal use only. | + +### `KeyVaultProperties` {#Azure.ResourceManager.CommonTypes.KeyVaultProperties} + +```typespec +model Azure.ResourceManager.CommonTypes.KeyVaultProperties +``` + +#### Properties + +| Name | Type | Description | +| -------------- | -------- | --------------------------------------------------------------------- | +| keyIdentifier? | `string` | Key vault uri to access the encryption key. | +| identity? | `string` | The client ID of the identity which will be used to access key vault. | + +### `locationData` {#Azure.ResourceManager.CommonTypes.locationData} + +Metadata pertaining to the geographic location of the resource. + +```typespec +model Azure.ResourceManager.CommonTypes.locationData +``` + +#### Properties + +| Name | Type | Description | +| ---------------- | -------- | --------------------------------------------------------------- | +| name | `string` | A canonical name for the geographic or physical location. | +| city? | `string` | The city or locality where the resource is located. | +| district? | `string` | The district, state, or province where the resource is located. | +| countryOrRegion? | `string` | The country or region where the resource is located | + +### `LocationParameter` {#Azure.ResourceManager.CommonTypes.LocationParameter} + +The default location parameter type. + +```typespec +model Azure.ResourceManager.CommonTypes.LocationParameter +``` + +#### Properties + +| Name | Type | Description | +| -------- | -------- | ------------------------- | +| location | `string` | The name of Azure region. | + ### `ManagedServiceIdentity` {#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity} -The properties of the managed service identities assigned to this resource. +Managed service identity (system assigned and/or user assigned identities) ```typespec model Azure.ResourceManager.CommonTypes.ManagedServiceIdentity @@ -1201,16 +1242,29 @@ model Azure.ResourceManager.CommonTypes.ManagedServiceIdentity #### Properties -| Name | Type | Description | -| ----------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------- | -| tenantId? | `string` | The Active Directory tenant id of the principal. | -| principalId? | `string` | The active directory identifier of this principal. | -| type | [`ManagedServiceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType) | The type of managed identity assigned to this resource. | -| userAssignedIdentities? | `Record` | The identities assigned to this resource by the user. | +| Name | Type | Description | +| ----------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- | +| principalId? | `Core.uuid` | The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. | +| tenantId? | `Core.uuid` | The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. | +| type | [`ManagedServiceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType) | The type of managed identity assigned to this resource. | +| userAssignedIdentities? | `Record \| null` | The identities assigned to this resource by the user. | + +### `ManagementGroupNameParameter` {#Azure.ResourceManager.CommonTypes.ManagementGroupNameParameter} + +The default ManagementGroupName parameter type. + +```typespec +model Azure.ResourceManager.CommonTypes.ManagementGroupNameParameter +``` + +#### Properties + +| Name | Type | Description | +| ------------------- | -------- | --------------------------------------------------------------- | +| managementGroupName | `string` | The name of the management group. The name is case insensitive. | ### `Operation` {#Azure.ResourceManager.CommonTypes.Operation} -Details of a REST API operation, returned from the Resource Provider Operations API Details of a REST API operation, returned from the Resource Provider Operations API ```typespec @@ -1229,7 +1283,6 @@ model Azure.ResourceManager.CommonTypes.Operation ### `OperationDisplay` {#Azure.ResourceManager.CommonTypes.OperationDisplay} -Localized display information for and operation. Localized display information for and operation. ```typespec @@ -1247,7 +1300,6 @@ model Azure.ResourceManager.CommonTypes.OperationDisplay ### `OperationIdParameter` {#Azure.ResourceManager.CommonTypes.OperationIdParameter} -The default operationId parameter type. The default operationId parameter type. ```typespec @@ -1262,7 +1314,6 @@ model Azure.ResourceManager.CommonTypes.OperationIdParameter ### `OperationListResult` {#Azure.ResourceManager.CommonTypes.OperationListResult} -A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. ```typespec @@ -1278,7 +1329,6 @@ model Azure.ResourceManager.CommonTypes.OperationListResult ### `OperationStatusResult` {#Azure.ResourceManager.CommonTypes.OperationStatusResult} -The current status of an async operation. The current status of an async operation. ```typespec @@ -1295,13 +1345,12 @@ model Azure.ResourceManager.CommonTypes.OperationStatusResult | percentComplete? | `float64` | Percent of the operation that is complete. | | startTime? | `utcDateTime` | The start time of the operation. | | endTime? | `utcDateTime` | The end time of the operation. | -| operations | `ResourceManager.CommonTypes.OperationStatusResult[]` | The operations list. | +| operations? | `ResourceManager.CommonTypes.OperationStatusResult[]` | The operations list. | | error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) | If present, details of the operation error. | ### `Plan` {#Azure.ResourceManager.CommonTypes.Plan} -Details of the resource plan. -Details of the resource plan. +Plan for the resource. ```typespec model Azure.ResourceManager.CommonTypes.Plan @@ -1319,7 +1368,7 @@ model Azure.ResourceManager.CommonTypes.Plan ### `PrivateEndpoint` {#Azure.ResourceManager.CommonTypes.PrivateEndpoint} -The private endpoint resource +The Private Endpoint resource. ```typespec model Azure.ResourceManager.CommonTypes.PrivateEndpoint @@ -1345,6 +1394,20 @@ model Azure.ResourceManager.CommonTypes.PrivateEndpointConnection | ----------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------ | | properties? | [`PrivateEndpointConnectionProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties) | The private endpoint connection properties | +### `PrivateEndpointConnectionListResult` {#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionListResult} + +List of private endpoint connections associated with the specified resource. + +```typespec +model Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionListResult +``` + +#### Properties + +| Name | Type | Description | +| ------ | --------------------------------------------------------- | -------------------------------------- | +| value? | `ResourceManager.CommonTypes.PrivateEndpointConnection[]` | Array of private endpoint connections. | + ### `PrivateEndpointConnectionParameter` {#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionParameter} The name of the private endpoint connection associated with the Azure resource. @@ -1367,7 +1430,7 @@ model Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionParameter | ---- | -------- | ---------------------------------------------------------------- | | name | `string` | The name of the private link associated with the Azure resource. | +### `PrivateLinkResourceProperties` {#Azure.ResourceManager.CommonTypes.PrivateLinkResourceProperties} + +Properties of a private link resource. + +```typespec +model Azure.ResourceManager.CommonTypes.PrivateLinkResourceProperties +``` + +#### Properties + +| Name | Type | Description | +| ------------------ | ---------- | ----------------------------------------------------- | +| groupId? | `string` | The private link resource group id. | +| requiredMembers? | `string[]` | The private link resource required member names. | +| requiredZoneNames? | `string[]` | The private link resource private link DNS zone name. | + ### `PrivateLinkServiceConnectionState` {#Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState} A collection of information about the state of the connection between service consumer and provider. @@ -1420,8 +1527,7 @@ model Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState ### `ProxyResource` {#Azure.ResourceManager.CommonTypes.ProxyResource} -The base proxy resource. -The base proxy resource. +The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location ```typespec model Azure.ResourceManager.CommonTypes.ProxyResource @@ -1434,7 +1540,6 @@ None ### `Resource` {#Azure.ResourceManager.CommonTypes.Resource} Base model that defines common properties for all Azure Resource Manager resources. -Common properties for all Azure Resource Manager resources. ```typespec model Azure.ResourceManager.CommonTypes.Resource @@ -1442,18 +1547,64 @@ model Azure.ResourceManager.CommonTypes.Resource #### Properties -| Name | Type | Description | -| ----------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| idV3? | `string` | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} | -| id? | `Core.uuid` | Fully qualified resource ID for the resource. E.g. \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}\" | -| name? | `string` | The name of the resource | -| type? | `string` | The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\ | -| systemData? | [`SystemData`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemData) | Azure Resource Manager metadata containing createdBy and modifiedBy information. | +| Name | Type | Description | +| ----------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| idV3? | `string` | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} | +| id? | `Core.armResourceIdentifier` | Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" | +| name? | `string` | The name of the resource | +| type? | `string` | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | +| systemData? | [`SystemData`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemData) | Azure Resource Manager metadata containing createdBy and modifiedBy information. | + +### `ResourceGroupNameParameter` {#Azure.ResourceManager.CommonTypes.ResourceGroupNameParameter} + +The default resource group parameter type. + +```typespec +model Azure.ResourceManager.CommonTypes.ResourceGroupNameParameter +``` + +#### Properties + +| Name | Type | Description | +| ----------------- | -------- | ------------------------------------------------------------- | +| resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | + +### `ResourceModelWithAllowedPropertySet` {#Azure.ResourceManager.CommonTypes.ResourceModelWithAllowedPropertySet} + +The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. + +```typespec +model Azure.ResourceManager.CommonTypes.ResourceModelWithAllowedPropertySet +``` + +#### Properties + +| Name | Type | Description | +| ---------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| managedBy? | `string` | The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource.
If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. | +| kind? | `string` | Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type.
If supported, the resource provider must validate and persist this value. | +| eTag? | `string` | The etag field is _not_ required. If it is provided in the response body, it must also be provided as a header per the normal etag convention.
Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19),
If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. | +| identity? | [`Identity`](./data-types.md#Azure.ResourceManager.CommonTypes.Identity) | | +| sku? | [`Sku`](./data-types.md#Azure.ResourceManager.CommonTypes.Sku) | | +| plan? | [`Plan`](./data-types.md#Azure.ResourceManager.CommonTypes.Plan) | | + +### `ScopeParameter` {#Azure.ResourceManager.CommonTypes.ScopeParameter} + +The default Scope parameter type. + +```typespec +model Azure.ResourceManager.CommonTypes.ScopeParameter +``` + +#### Properties + +| Name | Type | Description | +| ----- | -------- | ---------------------------------------------- | +| scope | `string` | The scope at which the operation is performed. | ### `Sku` {#Azure.ResourceManager.CommonTypes.Sku} -The SKU (Stock Keeping Unit) assigned to this resource. -The SKU (Stock Keeping Unit) assigned to this resource. +The resource model definition representing SKU ```typespec model Azure.ResourceManager.CommonTypes.Sku @@ -1463,7 +1614,7 @@ model Azure.ResourceManager.CommonTypes.Sku | Name | Type | Description | | --------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | `string` | The name of the SKU, usually a combination of letters and numbers, for example, 'P3' | +| name | `string` | The name of the SKU. Ex - P3. It is typically a letter+number code | | tier? | [`SkuTier`](./data-types.md#Azure.ResourceManager.CommonTypes.SkuTier) | 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. | | size? | `string` | The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. | | family? | `string` | If the service has different generations of hardware, for the same SKU, then that can be captured here. | @@ -1479,13 +1630,14 @@ model Azure.ResourceManager.CommonTypes.SubscriptionIdParameter #### Properties -| Name | Type | Description | -| -------------- | -------- | ---------------------------------- | -| subscriptionId | `string` | The ID of the target subscription. | +| Name | Type | Description | +| ---------------- | ----------- | ------------------------------------------------------------- | +| subscriptionIdV3 | `string` | The ID of the target subscription. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | ### `SystemAssignedServiceIdentity` {#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity} -The properties of the service-assigned identity associated with this resource. +Managed service identity (either system assigned, or none) ```typespec model Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity @@ -1493,15 +1645,14 @@ model Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity #### Properties -| Name | Type | Description | -| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | -| tenantId? | `string` | The Active Directory tenant id of the principal. | -| principalId? | `string` | The active directory identifier of this principal. | -| type | [`SystemAssignedServiceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType) | The type of managed identity assigned to this resource. | +| Name | Type | Description | +| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| principalId? | `Core.uuid` | The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. | +| tenantId? | `Core.uuid` | The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. | +| type | [`SystemAssignedServiceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType) | The type of managed identity assigned to this resource. | ### `SystemData` {#Azure.ResourceManager.CommonTypes.SystemData} -Metadata pertaining to creation and last modification of the resource. Metadata pertaining to creation and last modification of the resource. ```typespec @@ -1514,14 +1665,27 @@ model Azure.ResourceManager.CommonTypes.SystemData | ------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------- | | createdBy? | `string` | The identity that created the resource. | | createdByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.CommonTypes.createdByType) | The type of identity that created the resource. | -| createdAt? | `plainDate` | The type of identity that created the resource. | +| createdAt? | `plainDate` | The timestamp of resource creation (UTC). | | lastModifiedBy? | `string` | The identity that last modified the resource. | | lastModifiedByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.CommonTypes.createdByType) | The type of identity that last modified the resource. | | lastModifiedAt? | `plainDate` | The timestamp of resource last modification (UTC) | +### `TenantIdParameter` {#Azure.ResourceManager.CommonTypes.TenantIdParameter} + +The default ManagementGroupName parameter type. + +```typespec +model Azure.ResourceManager.CommonTypes.TenantIdParameter +``` + +#### Properties + +| Name | Type | Description | +| -------- | ----------- | ------------------------------------------------------------------------------------------------ | +| tenantId | `Core.uuid` | The Azure tenant ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) | + ### `TrackedResource` {#Azure.ResourceManager.CommonTypes.TrackedResource} -The base tracked resource. The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' ```typespec @@ -1532,12 +1696,12 @@ model Azure.ResourceManager.CommonTypes.TrackedResource | Name | Type | Description | | -------- | ---------------- | ----------------------------------------- | -| location | `string` | The geo-location where the resource lives | | tags? | `Record` | Resource tags. | +| location | `string` | The geo-location where the resource lives | ### `UserAssignedIdentities` {#Azure.ResourceManager.CommonTypes.UserAssignedIdentities} -The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", +The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. ```typespec model Azure.ResourceManager.CommonTypes.UserAssignedIdentities @@ -1551,7 +1715,7 @@ model Azure.ResourceManager.CommonTypes.UserAssignedIdentities ### `UserAssignedIdentity` {#Azure.ResourceManager.CommonTypes.UserAssignedIdentity} -A managed identity assigned by the user. +User assigned identity properties ```typespec model Azure.ResourceManager.CommonTypes.UserAssignedIdentity @@ -1559,10 +1723,10 @@ model Azure.ResourceManager.CommonTypes.UserAssignedIdentity #### Properties -| Name | Type | Description | -| ------------ | -------- | ---------------------------------------------------------- | -| clientId? | `string` | The active directory client identifier for this principal. | -| principalId? | `string` | The active directory identifier for this principal. | +| Name | Type | Description | +| ------------ | ----------- | ------------------------------------------ | +| principalId? | `Core.uuid` | The principal ID of the assigned identity. | +| clientId? | `Core.uuid` | The client ID of the assigned identity. | ### `ResourceHome` {#Azure.ResourceManager.CommonTypes.ResourceHome} @@ -1572,15 +1736,6 @@ An internal enum to indicate the resource support for various path types enum Azure.ResourceManager.CommonTypes.ResourceHome ``` -### `SkuTier` {#Azure.ResourceManager.CommonTypes.SkuTier} - -Available service tiers for the SKU. -Available service tiers for the SKU. - -```typespec -enum Azure.ResourceManager.CommonTypes.SkuTier -``` - ### `Versions` {#Azure.ResourceManager.CommonTypes.Versions} The Azure Resource Manager common-types versions. @@ -1591,7 +1746,6 @@ enum Azure.ResourceManager.CommonTypes.Versions ### `ActionType` {#Azure.ResourceManager.CommonTypes.ActionType} -Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ```typespec @@ -1600,7 +1754,6 @@ union Azure.ResourceManager.CommonTypes.ActionType ### `CheckNameAvailabilityReason` {#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason} -Possible reasons for a name not being available. Possible reasons for a name not being available. ```typespec @@ -1609,13 +1762,18 @@ union Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason ### `createdByType` {#Azure.ResourceManager.CommonTypes.createdByType} -The kind of entity that created the resource. The kind of entity that created the resource. ```typespec union Azure.ResourceManager.CommonTypes.createdByType ``` +### `EncryptionStatus` {#Azure.ResourceManager.CommonTypes.EncryptionStatus} + +```typespec +union Azure.ResourceManager.CommonTypes.EncryptionStatus +``` + ### `ExtendedLocationType` {#Azure.ResourceManager.CommonTypes.ExtendedLocationType} The supported ExtendedLocation types. @@ -1632,17 +1790,17 @@ union Azure.ResourceManager.CommonTypes.ExtendedLocationType union Azure.ResourceManager.CommonTypes.InfrastructureEncryption ``` -### `KeyEncryptionKeyIdentity` {#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity} +### `KeyEncryptionKeyIdentityType` {#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentityType} The type of identity to use. ```typespec -union Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity +union Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentityType ``` ### `ManagedServiceIdentityType` {#Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType} -The kind of managed identity assigned to this resource. +Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). ```typespec union Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType @@ -1650,7 +1808,6 @@ union Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType ### `Origin` {#Azure.ResourceManager.CommonTypes.Origin} -The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" ```typespec @@ -1659,7 +1816,7 @@ union Azure.ResourceManager.CommonTypes.Origin ### `PrivateEndpointConnectionProvisioningState` {#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState} -The provisioning state of the connection +The current provisioning state. ```typespec union Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState @@ -1667,15 +1824,29 @@ union Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningSta ### `PrivateEndpointServiceConnectionStatus` {#Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus} -The private endpoint connection status +The private endpoint connection status. ```typespec union Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus ``` +### `ResourceIdentityType` {#Azure.ResourceManager.CommonTypes.ResourceIdentityType} + +```typespec +union Azure.ResourceManager.CommonTypes.ResourceIdentityType +``` + +### `SkuTier` {#Azure.ResourceManager.CommonTypes.SkuTier} + +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. + +```typespec +union Azure.ResourceManager.CommonTypes.SkuTier +``` + ### `SystemAssignedServiceIdentityType` {#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType} -The kind of managemed identity assigned to this resource. +Type of managed service identity (either system assigned, or none). ```typespec union Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType @@ -1683,6 +1854,23 @@ union Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType ## Azure.ResourceManager.Foundations +### `ArmTagsProperty` {#Azure.ResourceManager.Foundations.ArmTagsProperty} + +Standard type definition for Azure Resource Manager Tags property. + +It is included in the TrackedResource template definition. +The Azure Resource Manager Resource tags. + +```typespec +model Azure.ResourceManager.Foundations.ArmTagsProperty +``` + +#### Properties + +| Name | Type | Description | +| ----- | ---------------- | -------------- | +| tags? | `Record` | Resource tags. | + ### `DefaultBaseParameters` {#Azure.ResourceManager.Foundations.DefaultBaseParameters} Base parameters for a resource. @@ -1699,13 +1887,14 @@ model Azure.ResourceManager.Foundations.DefaultBaseParameters #### Properties -| Name | Type | Description | -| ----------------- | -------- | ---------------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| location | `string` | The location name. | -| resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | -| resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | +| Name | Type | Description | +| ----------------- | ----------- | ---------------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionIdV3 | `string` | The ID of the target subscription. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| location | `string` | The location name. | +| resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | +| resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | ### `ExtensionBaseParameters` {#Azure.ResourceManager.Foundations.ExtensionBaseParameters} @@ -1754,11 +1943,12 @@ model Azure.ResourceManager.Foundations.LocationBaseParameters #### Properties -| Name | Type | Description | -| -------------- | -------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| location | `string` | The location name. | +| Name | Type | Description | +| ---------------- | ----------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionIdV3 | `string` | The ID of the target subscription. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| location | `string` | The location name. | ### `LocationScope` {#Azure.ResourceManager.Foundations.LocationScope} @@ -1776,12 +1966,13 @@ model Azure.ResourceManager.Foundations.LocationScope #### Properties -| Name | Type | Description | -| -------------- | -------------------------------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| location | `string` | The location name. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| Name | Type | Description | +| ---------------- | -------------------------------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionIdV3 | `string` | The ID of the target subscription. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| location | `string` | The location name. | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `ProxyResourceUpdateModel` {#Azure.ResourceManager.Foundations.ProxyResourceUpdateModel} @@ -1814,11 +2005,12 @@ model Azure.ResourceManager.Foundations.ResourceGroupBaseParameters #### Properties -| Name | Type | Description | -| ----------------- | -------- | ------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | +| Name | Type | Description | +| ----------------- | ----------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionIdV3 | `string` | The ID of the target subscription. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | ### `ResourceGroupScope` {#Azure.ResourceManager.Foundations.ResourceGroupScope} @@ -1839,7 +2031,8 @@ model Azure.ResourceManager.Foundations.ResourceGroupScope | Name | Type | Description | | ----------------- | -------------------------------- | ---------------------------------------------------------------------- | | apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | +| subscriptionIdV3 | `string` | The ID of the target subscription. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | | location | `string` | The location name. | | resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | | resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | @@ -1897,10 +2090,11 @@ model Azure.ResourceManager.Foundations.SubscriptionBaseParameters #### Properties -| Name | Type | Description | -| -------------- | -------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | +| Name | Type | Description | +| ---------------- | ----------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionIdV3 | `string` | The ID of the target subscription. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | ### `SubscriptionScope` {#Azure.ResourceManager.Foundations.SubscriptionScope} @@ -1918,11 +2112,12 @@ model Azure.ResourceManager.Foundations.SubscriptionScope #### Properties -| Name | Type | Description | -| -------------- | -------------------------------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| Name | Type | Description | +| ---------------- | -------------------------------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionIdV3 | `string` | The ID of the target subscription. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `TagsUpdateModel` {#Azure.ResourceManager.Foundations.TagsUpdateModel} diff --git a/docs/libraries/azure-resource-manager/reference/index.mdx b/docs/libraries/azure-resource-manager/reference/index.mdx index f018278395..563dfda1d7 100644 --- a/docs/libraries/azure-resource-manager/reference/index.mdx +++ b/docs/libraries/azure-resource-manager/reference/index.mdx @@ -137,7 +137,6 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`DefaultProvisioningStateProperty`](./data-types.md#Azure.ResourceManager.DefaultProvisioningStateProperty) - [`EncryptionProperty`](./data-types.md#Azure.ResourceManager.EncryptionProperty) - [`EntityTagProperty`](./data-types.md#Azure.ResourceManager.EntityTagProperty) -- [`ErrorResponse`](./data-types.md#Azure.ResourceManager.ErrorResponse) - [`ExtendedLocationProperty`](./data-types.md#Azure.ResourceManager.ExtendedLocationProperty) - [`ExtensionResource`](./data-types.md#Azure.ResourceManager.ExtensionResource) - [`KeysOf`](./data-types.md#Azure.ResourceManager.KeysOf) @@ -147,10 +146,6 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ManagedServiceIdentityProperty`](./data-types.md#Azure.ResourceManager.ManagedServiceIdentityProperty) - [`ManagedSystemAssignedIdentityProperty`](./data-types.md#Azure.ResourceManager.ManagedSystemAssignedIdentityProperty) - [`ParentKeysOf`](./data-types.md#Azure.ResourceManager.ParentKeysOf) -- [`PrivateEndpointConnectionResourceListResult`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnectionResourceListResult) -- [`PrivateLinkResource`](./data-types.md#Azure.ResourceManager.PrivateLinkResource) -- [`PrivateLinkResourceListResult`](./data-types.md#Azure.ResourceManager.PrivateLinkResourceListResult) -- [`PrivateLinkResourceProperties`](./data-types.md#Azure.ResourceManager.PrivateLinkResourceProperties) - [`ProviderNamespace`](./data-types.md#Azure.ResourceManager.ProviderNamespace) - [`ProxyResource`](./data-types.md#Azure.ResourceManager.ProxyResource) - [`ResourceGroupLocationResource`](./data-types.md#Azure.ResourceManager.ResourceGroupLocationResource) @@ -172,17 +167,26 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager ### Models - [`ApiVersionParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.ApiVersionParameter) -- [`ArmTagsProperty`](./data-types.md#Azure.ResourceManager.CommonTypes.ArmTagsProperty) - [`AzureEntityResource`](./data-types.md#Azure.ResourceManager.CommonTypes.AzureEntityResource) - [`CheckNameAvailabilityRequest`](./data-types.md#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest) - [`CheckNameAvailabilityResponse`](./data-types.md#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse) - [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption) -- [`EncryptionConfiguration`](./data-types.md#Azure.ResourceManager.CommonTypes.EncryptionConfiguration) +- [`Encryption`](./data-types.md#Azure.ResourceManager.CommonTypes.Encryption) +- [`encryptionProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.encryptionProperties) - [`ErrorAdditionalInfo`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo) - [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) +- [`ErrorResponse`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorResponse) - [`ExtendedLocation`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtendedLocation) - [`ExtensionResource`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtensionResource) +- [`Identity`](./data-types.md#Azure.ResourceManager.CommonTypes.Identity) +- [`IfMatchHeader`](./data-types.md#Azure.ResourceManager.CommonTypes.IfMatchHeader) +- [`IfNoneMatchHeader`](./data-types.md#Azure.ResourceManager.CommonTypes.IfNoneMatchHeader) +- [`KeyEncryptionKeyIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity) +- [`KeyVaultProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyVaultProperties) +- [`locationData`](./data-types.md#Azure.ResourceManager.CommonTypes.locationData) +- [`LocationParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.LocationParameter) - [`ManagedServiceIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity) +- [`ManagementGroupNameParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagementGroupNameParameter) - [`Operation`](./data-types.md#Azure.ResourceManager.CommonTypes.Operation) - [`OperationDisplay`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationDisplay) - [`OperationIdParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.OperationIdParameter) @@ -191,16 +195,24 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`Plan`](./data-types.md#Azure.ResourceManager.CommonTypes.Plan) - [`PrivateEndpoint`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpoint) - [`PrivateEndpointConnection`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnection) +- [`PrivateEndpointConnectionListResult`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionListResult) - [`PrivateEndpointConnectionParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionParameter) - [`PrivateEndpointConnectionProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties) +- [`PrivateLinkResource`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateLinkResource) +- [`PrivateLinkResourceListResult`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateLinkResourceListResult) - [`PrivateLinkResourceParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateLinkResourceParameter) +- [`PrivateLinkResourceProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateLinkResourceProperties) - [`PrivateLinkServiceConnectionState`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState) - [`ProxyResource`](./data-types.md#Azure.ResourceManager.CommonTypes.ProxyResource) - [`Resource`](./data-types.md#Azure.ResourceManager.CommonTypes.Resource) +- [`ResourceGroupNameParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.ResourceGroupNameParameter) +- [`ResourceModelWithAllowedPropertySet`](./data-types.md#Azure.ResourceManager.CommonTypes.ResourceModelWithAllowedPropertySet) +- [`ScopeParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.ScopeParameter) - [`Sku`](./data-types.md#Azure.ResourceManager.CommonTypes.Sku) - [`SubscriptionIdParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.SubscriptionIdParameter) - [`SystemAssignedServiceIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity) - [`SystemData`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemData) +- [`TenantIdParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.TenantIdParameter) - [`TrackedResource`](./data-types.md#Azure.ResourceManager.CommonTypes.TrackedResource) - [`UserAssignedIdentities`](./data-types.md#Azure.ResourceManager.CommonTypes.UserAssignedIdentities) - [`UserAssignedIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.UserAssignedIdentity) @@ -216,6 +228,7 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager ### Models +- [`ArmTagsProperty`](./data-types.md#Azure.ResourceManager.Foundations.ArmTagsProperty) - [`DefaultBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.DefaultBaseParameters) - [`ExtensionBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionBaseParameters) - [`ExtensionScope`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionScope) diff --git a/docs/libraries/azure-resource-manager/reference/interfaces.md b/docs/libraries/azure-resource-manager/reference/interfaces.md index 885a7c8275..28b8f79fd8 100644 --- a/docs/libraries/azure-resource-manager/reference/interfaces.md +++ b/docs/libraries/azure-resource-manager/reference/interfaces.md @@ -25,7 +25,7 @@ interface Azure.ResourceManager.ExtensionResourceCollectionOperations #### `ExtensionResourceCollectionOperations.listByParent` {#Azure.ResourceManager.ExtensionResourceCollectionOperations.listByParent} ```typespec -op Azure.ResourceManager.ExtensionResourceCollectionOperations.listByParent(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceCollectionOperations.listByParent(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ExtensionResourceInstanceOperations` {#Azure.ResourceManager.ExtensionResourceInstanceOperations} @@ -46,25 +46,25 @@ interface Azure.ResourceManager.ExtensionResourceInstanceOperations | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceInstanceOperations.get(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ExtensionResourceInstanceOperations.createOrUpdate` {#Azure.ResourceManager.ExtensionResourceInstanceOperations.createOrUpdate} ```typespec -op Azure.ResourceManager.ExtensionResourceInstanceOperations.createOrUpdate(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceInstanceOperations.createOrUpdate(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ExtensionResourceInstanceOperations.update` {#Azure.ResourceManager.ExtensionResourceInstanceOperations.update} ```typespec -op Azure.ResourceManager.ExtensionResourceInstanceOperations.update(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceInstanceOperations.update(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ExtensionResourceInstanceOperations.delete` {#Azure.ResourceManager.ExtensionResourceInstanceOperations.delete} ```typespec -op Azure.ResourceManager.ExtensionResourceInstanceOperations.delete(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceInstanceOperations.delete(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ExtensionResourceOperations` {#Azure.ResourceManager.ExtensionResourceOperations} @@ -85,31 +85,31 @@ interface Azure.ResourceManager.ExtensionResourceOperations | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceOperations.get(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ExtensionResourceOperations.createOrUpdate` {#Azure.ResourceManager.ExtensionResourceOperations.createOrUpdate} ```typespec -op Azure.ResourceManager.ExtensionResourceOperations.createOrUpdate(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceOperations.createOrUpdate(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ExtensionResourceOperations.update` {#Azure.ResourceManager.ExtensionResourceOperations.update} ```typespec -op Azure.ResourceManager.ExtensionResourceOperations.update(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceOperations.update(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ExtensionResourceOperations.delete` {#Azure.ResourceManager.ExtensionResourceOperations.delete} ```typespec -op Azure.ResourceManager.ExtensionResourceOperations.delete(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceOperations.delete(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ExtensionResourceOperations.listByParent` {#Azure.ResourceManager.ExtensionResourceOperations.listByParent} ```typespec -op Azure.ResourceManager.ExtensionResourceOperations.listByParent(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ExtensionResourceOperations.listByParent(apiVersion: string, resourceUri: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `Operations` {#Azure.ResourceManager.Operations} @@ -128,7 +128,7 @@ interface Azure.ResourceManager.Operations<> List the operations for the provider ```typespec -op Azure.ResourceManager.Operations.list(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.Operations.list(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ProxyResourceOperations` {#Azure.ResourceManager.ProxyResourceOperations} @@ -155,25 +155,25 @@ interface Azure.ResourceManager.ProxyResourceOperations | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ProxyResourceOperations.get(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ProxyResourceOperations.createOrUpdate` {#Azure.ResourceManager.ProxyResourceOperations.createOrUpdate} ```typespec -op Azure.ResourceManager.ProxyResourceOperations.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ProxyResourceOperations.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ProxyResourceOperations.delete` {#Azure.ResourceManager.ProxyResourceOperations.delete} ```typespec -op Azure.ResourceManager.ProxyResourceOperations.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ProxyResourceOperations.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ProxyResourceOperations.listByParent` {#Azure.ResourceManager.ProxyResourceOperations.listByParent} ```typespec -op Azure.ResourceManager.ProxyResourceOperations.listByParent(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ProxyResourceOperations.listByParent(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceCollectionOperations` {#Azure.ResourceManager.ResourceCollectionOperations} @@ -194,13 +194,13 @@ interface Azure.ResourceManager.ResourceCollectionOperations> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceCollectionOperations.listByParent(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceCollectionOperations.listBySubscription` {#Azure.ResourceManager.ResourceCollectionOperations.listBySubscription} ```typespec -op Azure.ResourceManager.ResourceCollectionOperations.listBySubscription(apiVersion: string, subscriptionId: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceCollectionOperations.listBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceCreateAsync` {#Azure.ResourceManager.ResourceCreateAsync} @@ -221,7 +221,7 @@ interface Azure.ResourceManager.ResourceCreateAsync #### `ResourceCreateAsync.createOrUpdate` {#Azure.ResourceManager.ResourceCreateAsync.createOrUpdate} ```typespec -op Azure.ResourceManager.ResourceCreateAsync.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceCreateAsync.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceCreateSync` {#Azure.ResourceManager.ResourceCreateSync} @@ -242,7 +242,7 @@ interface Azure.ResourceManager.ResourceCreateSync #### `ResourceCreateSync.createOrUpdate` {#Azure.ResourceManager.ResourceCreateSync.createOrUpdate} ```typespec -op Azure.ResourceManager.ResourceCreateSync.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedSyncResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceCreateSync.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedSyncResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceDeleteAsync` {#Azure.ResourceManager.ResourceDeleteAsync} @@ -261,7 +261,7 @@ interface Azure.ResourceManager.ResourceDeleteAsync #### `ResourceDeleteAsync.delete` {#Azure.ResourceManager.ResourceDeleteAsync.delete} ```typespec -op Azure.ResourceManager.ResourceDeleteAsync.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceDeleteAsync.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceDeleteSync` {#Azure.ResourceManager.ResourceDeleteSync} @@ -282,7 +282,7 @@ interface Azure.ResourceManager.ResourceDeleteSync #### `ResourceDeleteSync.delete` {#Azure.ResourceManager.ResourceDeleteSync.delete} ```typespec -op Azure.ResourceManager.ResourceDeleteSync.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceDeleteSync.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceDeleteWithoutOkAsync` {#Azure.ResourceManager.ResourceDeleteWithoutOkAsync} @@ -301,7 +301,7 @@ interface Azure.ResourceManager.ResourceDeleteWithoutOkAsync | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceDeleteWithoutOkAsync.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceInstanceOperations` {#Azure.ResourceManager.ResourceInstanceOperations} @@ -324,25 +324,25 @@ interface Azure.ResourceManager.ResourceInstanceOperations | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceInstanceOperations.get(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceInstanceOperations.createOrUpdate` {#Azure.ResourceManager.ResourceInstanceOperations.createOrUpdate} ```typespec -op Azure.ResourceManager.ResourceInstanceOperations.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceInstanceOperations.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceInstanceOperations.update` {#Azure.ResourceManager.ResourceInstanceOperations.update} ```typespec -op Azure.ResourceManager.ResourceInstanceOperations.update(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceInstanceOperations.update(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceInstanceOperations.delete` {#Azure.ResourceManager.ResourceInstanceOperations.delete} ```typespec -op Azure.ResourceManager.ResourceInstanceOperations.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceInstanceOperations.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceListByParent` {#Azure.ResourceManager.ResourceListByParent} @@ -365,7 +365,7 @@ interface Azure.ResourceManager.ResourceListByParent> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceListByParent.listByParent(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceListBySubscription` {#Azure.ResourceManager.ResourceListBySubscription} @@ -385,7 +385,7 @@ interface Azure.ResourceManager.ResourceListBySubscription #### `ResourceListBySubscription.listBySubscription` {#Azure.ResourceManager.ResourceListBySubscription.listBySubscription} ```typespec -op Azure.ResourceManager.ResourceListBySubscription.listBySubscription(apiVersion: string, subscriptionId: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceListBySubscription.listBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceOperations` {#Azure.ResourceManager.ResourceOperations} @@ -405,37 +405,37 @@ interface Azure.ResourceManager.ResourceOperations | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceOperations.get(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceOperations.createOrUpdate` {#Azure.ResourceManager.ResourceOperations.createOrUpdate} ```typespec -op Azure.ResourceManager.ResourceOperations.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceOperations.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceOperations.update` {#Azure.ResourceManager.ResourceOperations.update} ```typespec -op Azure.ResourceManager.ResourceOperations.update(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceOperations.update(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceOperations.delete` {#Azure.ResourceManager.ResourceOperations.delete} ```typespec -op Azure.ResourceManager.ResourceOperations.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceOperations.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceOperations.listByParent` {#Azure.ResourceManager.ResourceOperations.listByParent} ```typespec -op Azure.ResourceManager.ResourceOperations.listByParent(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceOperations.listByParent(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `ResourceOperations.listBySubscription` {#Azure.ResourceManager.ResourceOperations.listBySubscription} ```typespec -op Azure.ResourceManager.ResourceOperations.listBySubscription(apiVersion: string, subscriptionId: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceOperations.listBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceRead` {#Azure.ResourceManager.ResourceRead} @@ -456,7 +456,7 @@ interface Azure.ResourceManager.ResourceRead #### `ResourceRead.get` {#Azure.ResourceManager.ResourceRead.get} ```typespec -op Azure.ResourceManager.ResourceRead.get(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceRead.get(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceUpdateAsync` {#Azure.ResourceManager.ResourceUpdateAsync} @@ -476,7 +476,7 @@ interface Azure.ResourceManager.ResourceUpdateAsync): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ArmAcceptedLroResponse<"Resource update request accepted.", Azure.ResourceManager.{ location: string, retryAfter: int32 }> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceUpdateAsync.update(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ArmAcceptedLroResponse<"Resource update request accepted.", Azure.ResourceManager.{ location: string, retryAfter: int32 }> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceUpdateSync` {#Azure.ResourceManager.ResourceUpdateSync} @@ -498,7 +498,7 @@ interface Azure.ResourceManager.ResourceUpdateSync): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ResourceUpdateSync.update(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `TenantResourceOperations` {#Azure.ResourceManager.TenantResourceOperations} @@ -525,31 +525,31 @@ interface Azure.ResourceManager.TenantResourceOperations #### `TenantResourceOperations.get` {#Azure.ResourceManager.TenantResourceOperations.get} ```typespec -op Azure.ResourceManager.TenantResourceOperations.get(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TenantResourceOperations.get(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TenantResourceOperations.createOrUpdate` {#Azure.ResourceManager.TenantResourceOperations.createOrUpdate} ```typespec -op Azure.ResourceManager.TenantResourceOperations.createOrUpdate(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TenantResourceOperations.createOrUpdate(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TenantResourceOperations.update` {#Azure.ResourceManager.TenantResourceOperations.update} ```typespec -op Azure.ResourceManager.TenantResourceOperations.update(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TenantResourceOperations.update(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TenantResourceOperations.delete` {#Azure.ResourceManager.TenantResourceOperations.delete} ```typespec -op Azure.ResourceManager.TenantResourceOperations.delete(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TenantResourceOperations.delete(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TenantResourceOperations.listByParent` {#Azure.ResourceManager.TenantResourceOperations.listByParent} ```typespec -op Azure.ResourceManager.TenantResourceOperations.listByParent(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TenantResourceOperations.listByParent(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `TrackedResourceOperations` {#Azure.ResourceManager.TrackedResourceOperations} @@ -574,37 +574,37 @@ interface Azure.ResourceManager.TrackedResourceOperations | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TrackedResourceOperations.get(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TrackedResourceOperations.createOrUpdate` {#Azure.ResourceManager.TrackedResourceOperations.createOrUpdate} ```typespec -op Azure.ResourceManager.TrackedResourceOperations.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TrackedResourceOperations.createOrUpdate(provider: "Microsoft.ThisWillBeReplaced", resource: Resource): Azure.ResourceManager.ArmResourceUpdatedResponse | Azure.ResourceManager.ArmResourceCreatedResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TrackedResourceOperations.update` {#Azure.ResourceManager.TrackedResourceOperations.update} ```typespec -op Azure.ResourceManager.TrackedResourceOperations.update(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TrackedResourceOperations.update(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TrackedResourceOperations.delete` {#Azure.ResourceManager.TrackedResourceOperations.delete} ```typespec -op Azure.ResourceManager.TrackedResourceOperations.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TrackedResourceOperations.delete(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmDeletedResponse | Azure.ResourceManager.ArmDeleteAcceptedLroResponse | Azure.ResourceManager.ArmDeletedNoContentResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TrackedResourceOperations.listByParent` {#Azure.ResourceManager.TrackedResourceOperations.listByParent} ```typespec -op Azure.ResourceManager.TrackedResourceOperations.listByParent(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TrackedResourceOperations.listByParent(provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### `TrackedResourceOperations.listBySubscription` {#Azure.ResourceManager.TrackedResourceOperations.listBySubscription} ```typespec -op Azure.ResourceManager.TrackedResourceOperations.listBySubscription(apiVersion: string, subscriptionId: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.TrackedResourceOperations.listBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ArmCustomPatchAsync` {#Azure.ResourceManager.ArmCustomPatchAsync} @@ -651,7 +651,7 @@ op Azure.ResourceManager.ArmCustomPatchSync(provider: "Microsoft.ThisWillBeRepla A resource list operation, at the subscription scope ```typespec -op Azure.ResourceManager.ArmListBySubscription(apiVersion: string, subscriptionId: string, provider: "Microsoft.ThisWillBeReplaced"): Response | Error +op Azure.ResourceManager.ArmListBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Response | Error ``` #### Template Parameters @@ -970,7 +970,7 @@ op Azure.ResourceManager.ArmResourceListByParent(provider: "Microsoft.ThisWillBe ### `ArmResourcePatchAsync` {#Azure.ResourceManager.ArmResourcePatchAsync} ```typespec -op Azure.ResourceManager.ArmResourcePatchAsync(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ArmAcceptedLroResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ArmResourcePatchAsync(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ArmAcceptedLroResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters @@ -986,7 +986,7 @@ op Azure.ResourceManager.ArmResourcePatchAsync(provider: "Microsoft.ThisWillBeRe ### `ArmResourcePatchSync` {#Azure.ResourceManager.ArmResourcePatchSync} ```typespec -op Azure.ResourceManager.ArmResourcePatchSync(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ArmResourcePatchSync(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.ResourceUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters @@ -1019,7 +1019,7 @@ op Azure.ResourceManager.ArmResourceRead(provider: "Microsoft.ThisWillBeReplaced ### `ArmTagsPatchAsync` {#Azure.ResourceManager.ArmTagsPatchAsync} ```typespec -op Azure.ResourceManager.ArmTagsPatchAsync(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.TagsUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ArmAcceptedLroResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ArmTagsPatchAsync(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.TagsUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ArmAcceptedLroResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters @@ -1035,7 +1035,7 @@ op Azure.ResourceManager.ArmTagsPatchAsync(provider: "Microsoft.ThisWillBeReplac ### `ArmTagsPatchSync` {#Azure.ResourceManager.ArmTagsPatchSync} ```typespec -op Azure.ResourceManager.ArmTagsPatchSync(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.TagsUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.ArmTagsPatchSync(provider: "Microsoft.ThisWillBeReplaced", properties: Azure.ResourceManager.Foundations.TagsUpdateModel): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters @@ -1049,7 +1049,7 @@ op Azure.ResourceManager.ArmTagsPatchSync(provider: "Microsoft.ThisWillBeReplace ### `checkGlobalNameAvailability` {#Azure.ResourceManager.checkGlobalNameAvailability} ```typespec -op Azure.ResourceManager.checkGlobalNameAvailability(apiVersion: string, subscriptionId: string, provider: "Microsoft.ThisWillBeReplaced", body: Request): Response | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.checkGlobalNameAvailability(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced", body: Request): Response | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters @@ -1063,7 +1063,7 @@ op Azure.ResourceManager.checkGlobalNameAvailability(apiVersion: string, subscri ### `checkLocalNameAvailability` {#Azure.ResourceManager.checkLocalNameAvailability} ```typespec -op Azure.ResourceManager.checkLocalNameAvailability(apiVersion: string, subscriptionId: string, provider: "Microsoft.ThisWillBeReplaced", location: string, body: Request): Response | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.checkLocalNameAvailability(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced", location: string, body: Request): Response | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters @@ -1127,7 +1127,7 @@ a resource name must be globally unique (for example, if the resource exposes an endpoint that uses the resource name in the url) ```typespec -op Azure.ResourceManager.Foundations.checkNameAvailability(apiVersion: string, body: Request): Response | Azure.ResourceManager.ErrorResponse +op Azure.ResourceManager.Foundations.checkNameAvailability(apiVersion: string, body: Request): Response | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters diff --git a/packages/typespec-azure-resource-manager/lib/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/backcompat.tsp index ca31b574bd..5b745a6329 100644 --- a/packages/typespec-azure-resource-manager/lib/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/backcompat.tsp @@ -7,7 +7,7 @@ alias InfrastructureEncryption = CommonTypes.InfrastructureEncryption; alias KeyEncryptionIdentity = CommonTypes.KeyEncryptionKeyIdentity; alias KeyEncryptionKeyIdentity = CommonTypes.KeyEncryptionKeyIdentity; alias CustomerManagedKeyEncryption = CommonTypes.CustomerManagedKeyEncryption; -alias EncryptionConfiguration = CommonTypes.EncryptionConfiguration; +alias EncryptionConfiguration = CommonTypes.Encryption; // private-links alias PrivateEndpoint = CommonTypes.PrivateEndpoint; @@ -17,4 +17,9 @@ alias PrivateLinkServiceConnectionState = CommonTypes.PrivateLinkServiceConnecti alias PrivateEndpointConnectionProvisioningState = CommonTypes.PrivateEndpointConnectionProvisioningState; alias PrivateEndpointServiceConnectionStatus = CommonTypes.PrivateEndpointServiceConnectionStatus; alias PrivateEndpointConnectionParameter = CommonTypes.PrivateEndpointConnectionParameter; +alias PrivateLinkResource = CommonTypes.PrivateLinkResource; +alias PrivateLinkResourceProperties = CommonTypes.PrivateLinkResourceProperties; alias PrivateLinkResourceParameter = CommonTypes.PrivateLinkResourceParameter; + +// types +alias ErrorResponse = CommonTypes.ErrorResponse; diff --git a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp index 6766f97136..617b7375f5 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp @@ -1,13 +1,15 @@ import "./customer-managed-keys.tsp"; -namespace Azure.ResourceManager.CommonTypes.Private; +using Azure.ResourceManager.CommonTypes.Private; -@@armCommonDefinition(EncryptionConfiguration, +namespace Azure.ResourceManager.CommonTypes; + +@@armCommonDefinition(Encryption, "encryption", Azure.ResourceManager.CommonTypes.Versions.v4, "customermanagedkeys.json" ); -@@armCommonDefinition(EncryptionConfiguration, +@@armCommonDefinition(Encryption, "encryption", Azure.ResourceManager.CommonTypes.Versions.v5, "customermanagedkeys.json" diff --git a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp index dc7f66a372..577098f95b 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys.tsp @@ -4,7 +4,7 @@ using TypeSpec.Versioning; namespace Azure.ResourceManager.CommonTypes; /** (Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled. */ -@added(CommonTypes.Versions.v4) +@added(Versions.v4) union InfrastructureEncryption { /** Encryption is enabled */ Enabled: "enabled", @@ -15,12 +15,9 @@ union InfrastructureEncryption { string, } -/** Alias of keyEncryptionKeyIdentity for back compatibility. Please change to keyEncryptionKeyIdentity. */ -alias KeyEncryptionIdentity = KeyEncryptionKeyIdentity; - /** The type of identity to use. */ -@added(CommonTypes.Versions.v4) -union KeyEncryptionKeyIdentity { +@added(Versions.v4) +union KeyEncryptionKeyIdentityType { /** System assigned identity */ SystemAssignedIdentity: "systemAssignedIdentity", @@ -33,11 +30,11 @@ union KeyEncryptionKeyIdentity { string, } -/** Customer-managed key encryption properties for the resource. */ -@added(CommonTypes.Versions.v4) -model CustomerManagedKeyEncryption { +/** All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. */ +@added(Versions.v4) +model KeyEncryptionKeyIdentity { /** The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. */ - keyEncryptionKeyIdentity?: KeyEncryptionKeyIdentity; + identityType?: KeyEncryptionKeyIdentityType; /** User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. */ userAssignedIdentityResourceId?: Azure.Core.armResourceIdentifier<[ @@ -47,21 +44,32 @@ model CustomerManagedKeyEncryption { ]>; /** application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540 */ + @added(Versions.v5) federatedClientId?: uuid; /** delegated identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity and userAssignedIdentity - internal use only. */ delegatedIdentityClientId?: uuid; } -/** All encryption configuration for a resource. */ -@added(CommonTypes.Versions.v4) -model EncryptionConfiguration { - /** Indicates if infrastructure encryption is enabled or disabled. */ +/** Customer-managed key encryption properties for the resource. */ +@added(Versions.v4) +model CustomerManagedKeyEncryption { + /** All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. */ + keyEncryptionKeyIdentity?: KeyEncryptionKeyIdentity; + + /** key encryption key Url, versioned or non-versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. */ + keyEncryptionKeyUrl?: string; +} + +/** (Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled. */ +@added(Versions.v4) +@encodedName("application/json", "encryption") +model Encryption { + /** Values are enabled and disabled. */ infrastructureEncryption?: InfrastructureEncryption; - /** All customer-managed key encryption properties for the resource. */ + /** All Customer-managed key encryption properties for the resource. */ + @added(Versions.v4) + @removed(Versions.v5) customerManagedKeyEncryption?: CustomerManagedKeyEncryption; - - /** key encryption key Url, versioned or unversioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. */ - keyEncryptionKeyUrl?: string; } diff --git a/packages/typespec-azure-resource-manager/lib/common-types/internal.tsp b/packages/typespec-azure-resource-manager/lib/common-types/internal.tsp index d7d6eb7062..c1334a48a3 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/internal.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/internal.tsp @@ -19,3 +19,6 @@ enum ResourceHome { @doc("The resource is bound to an extension") Extension, } + +/** Alias of keyEncryptionKeyIdentity for back compatibility. Please change to keyEncryptionKeyIdentity. */ +alias KeyEncryptionIdentity = KeyEncryptionKeyIdentity; diff --git a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp index f0384e42d5..f42f111d84 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp @@ -1,87 +1,100 @@ -using Azure.ResourceManager.Private; +using Azure.Core; +using TypeSpec.Versioning; namespace Azure.ResourceManager.CommonTypes; +/** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. */ +#deprecated "Do not use this model. Instead, use Record directly. Using this model will result in a different client SDK when generated from TypeSpec compared to the Swagger." +model UserAssignedIdentities is Record; + /** - * The properties of the managed service identities assigned to this resource. + * Managed service identity (system assigned and/or user assigned identities) */ model ManagedServiceIdentity { - @doc("The Active Directory tenant id of the principal.") + /** The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. */ @visibility("read") - tenantId?: string; + principalId?: uuid; - @doc("The active directory identifier of this principal.") + /** The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. */ @visibility("read") - principalId?: string; + tenantId?: uuid; - @doc("The type of managed identity assigned to this resource.") + /** The type of managed identity assigned to this resource. */ type: ManagedServiceIdentityType; - @doc("The identities assigned to this resource by the user.") - userAssignedIdentities?: Record; + /** The identities assigned to this resource by the user. */ + @typeChangedFrom(Versions.v5, Record) + userAssignedIdentities?: Record | null; } -/** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", */ -#deprecated "Do not use this model. Instead, use Record directly. Using this model will result in a different client SDK when generated from TypeSpec compared to the Swagger." -model UserAssignedIdentities is Record; - /** - * The properties of the service-assigned identity associated with this resource. + * Managed service identity (either system assigned, or none) */ model SystemAssignedServiceIdentity { - @doc("The Active Directory tenant id of the principal.") + /** The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. */ @visibility("read") - tenantId?: string; + principalId?: uuid; - @doc("The active directory identifier of this principal.") + /** The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. */ @visibility("read") - principalId?: string; + tenantId?: uuid; - @doc("The type of managed identity assigned to this resource.") + /** The type of managed identity assigned to this resource. */ type: SystemAssignedServiceIdentityType; } /** - * A managed identity assigned by the user. + * User assigned identity properties */ -@doc("A managed identity assigned by the user.") model UserAssignedIdentity { - @doc("The active directory client identifier for this principal.") - clientId?: string; + /** The principal ID of the assigned identity. */ + @visibility("read") + principalId?: uuid; - @doc("The active directory identifier for this principal.") - principalId?: string; + /** The client ID of the assigned identity. */ + @visibility("read") + clientId?: uuid; } /** - * The kind of managed identity assigned to this resource. + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ -@doc("The kind of managed identity assigned to this resource.") union ManagedServiceIdentityType { - @doc("No managed identity.") + /** No managed identity. */ None: "None", - @doc("System assigned managed identity.") + /** System assigned managed identity. */ SystemAssigned: "SystemAssigned", - @doc("User assigned managed identity.") + /** User assigned managed identity. */ UserAssigned: "UserAssigned", - @doc("System and user assigned managed identity.") - SystemAndUserAssigned: "SystemAssigned, UserAssigned", + /** System and user assigned managed identity. */ + @renamedFrom(Versions.v3, "SystemAndUserAssigned") + @removed(Versions.v4) + SystemAndUserAssignedV3: "SystemAssigned,UserAssigned", + + /** System and user assigned managed identity. */ + @added(Versions.v4) + @renamedFrom(Versions.v4, "SystemAndUserAssigned") + @removed(Versions.v5) + SystemAndUserAssignedV4: "SystemAssigned, UserAssigned", + + /** System and user assigned managed identity. */ + @added(Versions.v5) + SystemAndUserAssigned: "SystemAssigned,UserAssigned", string, } /** - * The kind of managemed identity assigned to this resource. + * Type of managed service identity (either system assigned, or none). */ -@doc("The kind of managemed identity assigned to this resource.") union SystemAssignedServiceIdentityType { - @doc("No managed system identity.") + /** No managed system identity. */ None: "None", - @doc("System assigned managed system identity.") + /** System assigned managed system identity. */ SystemAssigned: "SystemAssigned", string, diff --git a/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp index 940538087f..c1f5c6c1ed 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp @@ -52,3 +52,14 @@ namespace Azure.ResourceManager.CommonTypes; Azure.ResourceManager.CommonTypes.Versions.v5, "privatelinks.json" ); + +@@CommonTypes.Private.armCommonParameter(PrivateEndpointConnectionParameter.name, + "PrivateEndpointConnectionName", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "privatelinks.json" +); +@@CommonTypes.Private.armCommonParameter(PrivateEndpointConnectionParameter.name, + "PrivateEndpointConnectionName", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp b/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp index 6f2c20c664..694bb96022 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/private-links.tsp @@ -1,12 +1,13 @@ using TypeSpec.Http; using TypeSpec.Versioning; +using OpenAPI; namespace Azure.ResourceManager.CommonTypes; -/** The private endpoint resource */ -@added(CommonTypes.Versions.v4) +/** The Private Endpoint resource. */ model PrivateEndpoint { /** The resource identifier for private endpoint */ + @visibility("read") id?: Azure.Core.armResourceIdentifier<[ { type: "Microsoft.Network/privateEndpoints"; @@ -14,32 +15,65 @@ model PrivateEndpoint { ]>; } +/** A private link resource. */ +model PrivateLinkResource extends Resource { + /** Resource properties. */ + @extension("x-ms-client-flatten", true) + properties?: PrivateLinkResourceProperties; +} + +/** Properties of a private link resource. */ +model PrivateLinkResourceProperties { + /** The private link resource group id. */ + @visibility("read") + groupId?: string; + + /** The private link resource required member names. */ + @visibility("read") + requiredMembers?: string[]; + + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +/** A list of private link resources. */ +model PrivateLinkResourceListResult { + /** Array of private link resources */ + value?: PrivateLinkResource[]; +} +//#region /** The private endpoint connection resource */ -@added(CommonTypes.Versions.v4) -model PrivateEndpointConnection extends Azure.ResourceManager.Foundations.ProxyResource { +model PrivateEndpointConnection extends Resource { /** The private endpoint connection properties */ + @extension("x-ms-client-flatten", true) properties?: PrivateEndpointConnectionProperties; } -/** Properties of he private endpoint connection resource */ -@added(CommonTypes.Versions.v4) +/** List of private endpoint connections associated with the specified resource. */ +model PrivateEndpointConnectionListResult { + /** Array of private endpoint connections. */ + value?: PrivateEndpointConnection[]; +} + +/** Properties of the private endpoint connection. */ model PrivateEndpointConnectionProperties { - /** The group identifiers for the private endpoint resource */ + /** The group ids for the private endpoint resource. */ @visibility("read") + @added(Versions.v4) groupIds?: string[]; - /** The private endpoint resource */ + /** The private endpoint resource. */ privateEndpoint?: PrivateEndpoint; /** A collection of information about the state of the connection between service consumer and provider. */ privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; /** The provisioning state of the private endpoint connection resource. */ + @visibility("read") provisioningState?: PrivateEndpointConnectionProvisioningState; } /** A collection of information about the state of the connection between service consumer and provider. */ -@added(CommonTypes.Versions.v4) model PrivateLinkServiceConnectionState { /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ status?: PrivateEndpointServiceConnectionStatus; @@ -51,20 +85,24 @@ model PrivateLinkServiceConnectionState { actionsRequired?: string; } -/** The provisioning state of the connection */ -@added(CommonTypes.Versions.v4) +/** The current provisioning state. */ union PrivateEndpointConnectionProvisioningState { - ResourceProvisioningState, + string, + + /** Connection has been provisioned */ + Succeeded: "Succeeded", /** Connection is being created */ Creating: "Creating", /** Connection is being deleted */ Deleting: "Deleting", + + /** Connection provisioning has failed */ + Failed: "Failed", } -/** The private endpoint connection status */ -@added(CommonTypes.Versions.v4) +/** The private endpoint connection status. */ union PrivateEndpointServiceConnectionStatus { /** Connectionaiting for approval or rejection */ Pending: "Pending", @@ -82,20 +120,9 @@ union PrivateEndpointServiceConnectionStatus { * The name of the private endpoint connection associated with the Azure resource. * @template Segment The resource type name for private endpoint connections (default is privateEndpointConnections) */ -@added(CommonTypes.Versions.v4) model PrivateEndpointConnectionParameter { /** The name of the private endpoint connection associated with the Azure resource. */ @path - @CommonTypes.Private.armCommonParameter( - "PrivateEndpointConnectionName", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, - "privatelinks.json" - ) - @CommonTypes.Private.armCommonParameter( - "PrivateEndpointConnectionName", - Azure.ResourceManager.CommonTypes.Versions.v5, - "privatelinks.json" - ) @TypeSpec.Rest.segment(Segment) @key("privateEndpointConnectionName") name: string; @@ -105,7 +132,6 @@ model PrivateEndpointConnectionParameter { /** The name of the private link associated with the Azure resource. */ @path diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp index 05effb58d6..d2bd98898c 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp @@ -2,6 +2,7 @@ import "../private.decorators.tsp"; import "./common-types.tsp"; import "./types.tsp"; +using Azure.ResourceManager.Private; using Azure.ResourceManager.CommonTypes.Private; namespace Azure.ResourceManager.CommonTypes; @@ -233,6 +234,16 @@ namespace Azure.ResourceManager.CommonTypes; Azure.ResourceManager.CommonTypes.Versions.v5 ); +@@resourceParameterBaseFor(ApiVersionParameter.apiVersion, + [ + ResourceHome.ResourceGroup, + ResourceHome.Subscription, + ResourceHome.Location, + ResourceHome.Tenant, + ResourceHome.Extension + ] +); + @@armCommonParameter(SubscriptionIdParameter.subscriptionId, "SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v3 @@ -245,3 +256,19 @@ namespace Azure.ResourceManager.CommonTypes; "SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v5 ); +@@resourceParameterBaseFor(SubscriptionIdParameter.subscriptionId, + [ResourceHome.ResourceGroup, ResourceHome.Subscription, ResourceHome.Location] +); + +@@armCommonDefinition(ErrorResponse, + "ErrorResponse", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(ErrorResponse, + "ErrorResponse", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(ErrorResponse, + "ErrorResponse", + Azure.ResourceManager.CommonTypes.Versions.v5 +); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 6f9ed8e323..af1de64582 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -3,32 +3,31 @@ using TypeSpec.Rest; using TypeSpec.OpenAPI; using TypeSpec.Versioning; using Azure.Core; -using Azure.ResourceManager.Private; -using Azure.ResourceManager.CommonTypes.Private; namespace Azure.ResourceManager.CommonTypes; /** * Base model that defines common properties for all Azure Resource Manager resources. */ -/** Common properties for all Azure Resource Manager resources. */ +@doc("Common fields that are returned in the response for all Azure Resource Manager resources") +@extension("x-ms-azure-resource", true) model Resource { /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ - @renamedFrom(Versions.v3, "id") + @renamedFrom(Versions.v4, "id") @removed(Versions.v4) @visibility("read") idV3?: string; - /** Fully qualified resource ID for the resource. E.g. \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}\" */ + /** Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" */ @added(CommonTypes.Versions.v4) @visibility("read") - id?: uuid; + id?: armResourceIdentifier; /** The name of the resource */ @visibility("read") name?: string; - /** The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\ */ + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ @visibility("read") type?: string; @@ -41,51 +40,61 @@ model Resource { model AzureEntityResource extends Resource { /** Resource Etag. */ @visibility("read") - etag: string; + etag?: string; } /** - * Standard type definition for Azure Resource Manager Tags property. - * - * It is included in the TrackedResource template definition. + * The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -/** The Azure Resource Manager Resource tags. */ -model ArmTagsProperty { +model TrackedResource extends Resource { /** Resource tags. */ tags?: Record; -} -/** - * The base tracked resource. - */ -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -model TrackedResource extends Resource { /** The geo-location where the resource lives */ @visibility("read", "create") location: string; - - ...ArmTagsProperty; } /** - * The base proxy resource. + * The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -/** The base proxy resource. */ model ProxyResource extends Resource {} /** * The base extension resource. */ // Note that ProxyResource is the base definition for both kinds of resources -/** The base extension resource. */ model ExtensionResource extends Resource {} /** - * The SKU (Stock Keeping Unit) assigned to this resource. + * The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. + */ +@extension("x-ms-azure-resource", true) +model ResourceModelWithAllowedPropertySet extends TrackedResource { + /** The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. + * If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. */ + managedBy?: string; + + /** Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. + * If supported, the resource provider must validate and persist this value. */ + @pattern("^[-\\w\\._,\\(\\)]+$") + kind?: string; + + /** The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. + * Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), + * If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. */ + eTag?: string; + + identity?: Identity; + sku?: Sku; + plan?: Plan; +} + +/** + * The resource model definition representing SKU */ -/** The SKU (Stock Keeping Unit) assigned to this resource. */ model Sku { - /** The name of the SKU, usually a combination of letters and numbers, for example, 'P3' */ + /** The name of the SKU. Ex - P3. It is typically a letter+number code */ name: string; /** 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. */ @@ -102,35 +111,31 @@ model Sku { } /** - * Available service tiers for the SKU. + * 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. */ -/** Available service tiers for the SKU. */ -enum SkuTier { +union SkuTier { /** The Free service tier. */ - Free, + Free: "Free", /** The Basic service tier. */ - Basic, + Basic: "Basic", /** The Standard service tier. */ - Standard, + Standard: "Standard", /** The Premium service tier. */ - Premium, + Premium: "Premium", } /** * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -/** -A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - */ +@friendlyName("OperationListResult") model OperationListResult is Azure.Core.Page; /** * Details of a REST API operation, returned from the Resource Provider Operations API */ -/** Details of a REST API operation, returned from the Resource Provider Operations API */ model Operation { /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" @@ -156,13 +161,13 @@ model Operation { /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + @visibility("read") actionType?: ActionType; } /** * Localized display information for and operation. */ -/** Localized display information for and operation. */ model OperationDisplay { /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". @@ -186,7 +191,6 @@ model OperationDisplay { /** * The current status of an async operation. */ -/** The current status of an async operation. */ model OperationStatusResult { /** Fully qualified ID for the async operation. */ id?: string; @@ -209,29 +213,15 @@ model OperationStatusResult { endTime?: utcDateTime; /** The operations list. */ - operations: OperationStatusResult[]; + operations?: OperationStatusResult[]; /** If present, details of the operation error. */ error?: ErrorDetail; } -/** - * The default operationId parameter type. - */ -/** The default operationId parameter type. */ -model OperationIdParameter { - /** The ID of an ongoing async operation. */ - @path - @minLength(1) - operationId: string; -} - /** * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ -/** -Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - */ union ActionType { /** Actions are for internal-only APIs. */ Internal: "Internal", @@ -242,9 +232,6 @@ union ActionType { /** * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ -/** -The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - */ union Origin { /** Indicates the operation is initiated by a user. */ user: "user", @@ -261,7 +248,6 @@ union Origin { /** * The error detail. */ -/** The error detail. */ model ErrorDetail { /** The error code. */ @visibility("read") @@ -281,15 +267,22 @@ model ErrorDetail { details?: ErrorDetail[]; /** The error additional info. */ - @extension("x-ms-identifiers", ["message", "target"]) @visibility("read") additionalInfo?: ErrorAdditionalInfo[]; } +/** + * Common error response for all Azure Resource Manager APIs to return error details for failed operations. + */ +@error +model ErrorResponse { + @doc("The error object.") + error?: ErrorDetail; +} + /** * The resource management error additional info. */ -/** The resource management error additional info. */ model ErrorAdditionalInfo { /** The additional info type. */ @visibility("read") @@ -303,7 +296,6 @@ model ErrorAdditionalInfo { /** * Metadata pertaining to creation and last modification of the resource. */ -/** Metadata pertaining to creation and last modification of the resource. */ model SystemData { /** The identity that created the resource. */ @visibility("read") @@ -313,7 +305,7 @@ model SystemData { @visibility("read") createdByType?: createdByType; - /** The type of identity that created the resource. */ + /** The timestamp of resource creation (UTC). */ @visibility("read") createdAt?: plainDate; @@ -334,7 +326,6 @@ model SystemData { * The kind of entity that created the resource. */ // NOTE: This is how the extensible enum is named in types.json -/** The kind of entity that created the resource. */ union createdByType { /** The entity was created by a user. */ User: "User", @@ -351,17 +342,48 @@ union createdByType { string, } -// /** Identity for the resource. */ -// model Identity { -// principalId?: string; -// tenantId?: string; -// type?: enum {SystemAssigned} -// } +union ResourceIdentityType { + SystemAssigned: "SystemAssigned", +} + +/** Identity for the resource. */ +model Identity { + /** The principal ID of resource identity. */ + @renamedFrom(Versions.v4, "principalId") + @removed(Versions.v4) + @visibility("read") + principalIdV3?: string; + + /** The principal ID of resource identity. The value must be an UUID. */ + @added(CommonTypes.Versions.v4) + @visibility("read") + principalId?: uuid; + + /** The tenant ID of resource. */ + @renamedFrom(Versions.v4, "tenantId") + @removed(Versions.v4) + @visibility("read") + tenantIdV3?: string; + + /** The tenant ID of resource. The value must be an UUID. */ + @added(CommonTypes.Versions.v4) + @visibility("read") + tenantId?: uuid; + /** The identity type. */ + type?: ResourceIdentityType; +} + +model KeyVaultProperties { + /** Key vault uri to access the encryption key. */ + keyIdentifier?: string; + + /** The client ID of the identity which will be used to access key vault. */ + identity?: string; +} /** - * Details of the resource plan. + * Plan for the resource. */ -/** Details of the resource plan. */ model Plan { /** A user defined name of the 3rd Party Artifact that is being procured. */ name: string; @@ -382,7 +404,6 @@ model Plan { /** * The check availability request body. */ -/** The check availability request body. */ model CheckNameAvailabilityRequest { /** The name of the resource for which availability needs to be checked. */ name?: string; @@ -394,7 +415,6 @@ model CheckNameAvailabilityRequest { /** * The check availability result. */ -/** The check availability result. */ model CheckNameAvailabilityResponse { /** Indicates if the resource name is available. */ nameAvailable?: boolean; @@ -409,7 +429,6 @@ model CheckNameAvailabilityResponse { /** * Possible reasons for a name not being available. */ -/** Possible reasons for a name not being available. */ union CheckNameAvailabilityReason { /** Name is invalid. */ Invalid: "Invalid", @@ -420,6 +439,40 @@ union CheckNameAvailabilityReason { string, } +union EncryptionStatus { + enabled: "enabled", + disabled: "disabled", + string, +} +/** + * Configuration of key for data encryption + */ +model encryptionProperties { + /** Indicates whether or not the encryption is enabled for container registry. */ + status?: EncryptionStatus; + + /** Key vault properties. */ + keyVaultProperties?: KeyVaultProperties; +} + +/** + * Metadata pertaining to the geographic location of the resource. + */ +model locationData { + /** A canonical name for the geographic or physical location. */ + @maxLength(256) + name: string; + + /** The city or locality where the resource is located. */ + city?: string; + + /** The district, state, or province where the resource is located. */ + district?: string; + + /** The country or region where the resource is located */ + countryOrRegion?: string; +} + /** * The default api-version parameter type. */ @@ -428,29 +481,116 @@ model ApiVersionParameter { @query("api-version") @minLength(1) @doc("The API version to use for this operation.") - @resourceParameterBaseFor( - [ - ResourceHome.ResourceGroup, - ResourceHome.Subscription, - ResourceHome.Location, - ResourceHome.Tenant, - ResourceHome.Extension - ] - ) apiVersion: string; } +/** + * The default operationId parameter type. + */ +model OperationIdParameter { + /** The ID of an ongoing async operation. */ + @path + @minLength(1) + operationId: string; +} + +/** + * The default location parameter type. + */ +model LocationParameter { + /** The name of Azure region. */ + @path + @minLength(1) + @segment("locations") + location: string; +} + +/** + * The default resource group parameter type. + */ +model ResourceGroupNameParameter { + /** The name of the resource group. The name is case insensitive. */ + @path + @minLength(1) + @maxLength(90) + @segment("resourceGroups") + @pattern("^[-\\w\\._\\(\\)]+$") + resourceGroupName: string; +} + /** * The default subscriptionId parameter type. */ @doc("The default subscriptionId parameter type.") model SubscriptionIdParameter { + @renamedFrom(Versions.v4, "subscriptionId") + @removed(Versions.v4) @path @minLength(1) @segment("subscriptions") @doc("The ID of the target subscription.") - @resourceParameterBaseFor( - [ResourceHome.ResourceGroup, ResourceHome.Subscription, ResourceHome.Location] - ) - subscriptionId: string; + subscriptionIdV3: string; + + @added(Versions.v4) + @path + @segment("subscriptions") + @doc("The ID of the target subscription. The value must be an UUID.") + subscriptionId: uuid; +} + +/** + * The default ManagementGroupName parameter type. + */ +@added(Versions.v4) +model ManagementGroupNameParameter { + /** The name of the management group. The name is case insensitive. */ + @path + @minLength(1) + @maxLength(90) + @segment("managementGroups") + managementGroupName: string; +} + +/** + * The default Scope parameter type. + */ +@added(Versions.v4) +model ScopeParameter { + /** The scope at which the operation is performed. */ + @path + @segment("scope") + @minLength(1) + @extension("x-ms-skip-url-encoding", true) + scope: string; +} + +/** + * The default ManagementGroupName parameter type. + */ +@added(Versions.v4) +model TenantIdParameter { + /** The Azure tenant ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) */ + @path + @segment("tenant") + tenantId: uuid; +} + +/** + * The default ARM If-Match header type. + */ +@added(Versions.v4) +model IfMatchHeader { + /** The If-Match header that makes a request conditional. */ + @header("If-Match") + ifMatch: string; +} + +/** + * The default ARM If-Match header type. + */ +@added(Versions.v4) +model IfNoneMatchHeader { + /** The If-None-Match header that makes a request conditional. */ + @header("If-None-Match") + ifNoneMatch: string; } diff --git a/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp b/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp index a63cb25c74..644bc0437f 100644 --- a/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp +++ b/packages/typespec-azure-resource-manager/lib/foundations/arm.foundations.tsp @@ -44,6 +44,17 @@ model DefaultBaseParameters { ...ResourceUriParameter; } +/** + * Standard type definition for Azure Resource Manager Tags property. + * + * It is included in the TrackedResource template definition. + */ +/** The Azure Resource Manager Resource tags. */ +model ArmTagsProperty { + /** Resource tags. */ + tags?: Record; +} + /** * The static parameters for a tenant-based resource */ diff --git a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp index e435f51f7c..e8b0595352 100644 --- a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp @@ -16,7 +16,6 @@ namespace Azure.ResourceManager.Foundations { // types alias Resource = CommonTypes.Resource; alias AzureEntityResource = CommonTypes.AzureEntityResource; - alias ArmTagsProperty = CommonTypes.ArmTagsProperty; alias TrackedResource = CommonTypes.TrackedResource; alias ProxyResource = CommonTypes.ProxyResource; alias ExtensionResource = CommonTypes.ExtensionResource; diff --git a/packages/typespec-azure-resource-manager/lib/models.tsp b/packages/typespec-azure-resource-manager/lib/models.tsp index 1a39da1daa..1f21dc5a06 100644 --- a/packages/typespec-azure-resource-manager/lib/models.tsp +++ b/packages/typespec-azure-resource-manager/lib/models.tsp @@ -80,40 +80,6 @@ model ExtensionResource extends Foundations.ExtensionReso } //#region -//#region Private Link models -model PrivateLinkResource extends Foundations.ProxyResource { - /** Properties of the private link resource. */ - properties?: PrivateLinkResourceProperties; -} - -/** Properties of a private link resource. */ -#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Matches current common code" -model PrivateLinkResourceProperties { - /** The private link resource group id. */ - @visibility("read") - groupId?: string; - - /** The private link resource required member names. */ - @visibility("read") - requiredMembers?: string[]; - - /** The private link resource private link DNS zone name. */ - requiredZoneNames?: string[]; -} - -/** List of private endpoint connections associated with the specified resource. */ -model PrivateEndpointConnectionResourceListResult { - /** Array of private endpoint connections */ - value?: PrivateEndpointConnection[]; -} - -/** A list of private link resources. */ -model PrivateLinkResourceListResult { - /** Array of private link resources */ - value?: PrivateLinkResource[]; -} -//#region - //#region Standard extraction models /** diff --git a/packages/typespec-azure-resource-manager/lib/responses.tsp b/packages/typespec-azure-resource-manager/lib/responses.tsp index 2d2eb91286..883571d3e7 100644 --- a/packages/typespec-azure-resource-manager/lib/responses.tsp +++ b/packages/typespec-azure-resource-manager/lib/responses.tsp @@ -240,19 +240,6 @@ model ArmResourceCreatedSyncResponse { enum Versions { @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @useDependency(Azure.Core.Versions.v1_0_Preview_1) @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) v2021_09_21: "2022-09-21-preview", @doc(".") @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @useDependency(Azure.Core.Versions.v1_0_Preview_1) @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v4) v2022_01_10: "2022-01-10-alpha.1" } From a0a0020d5870de6887c7e739c82b54a40cc98cf7 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 7 Jun 2024 12:05:16 -0700 Subject: [PATCH 15/25] Fixing some versioning issue --- .../reference/data-types.md | 79 ++++++++----------- .../reference/interfaces.md | 14 ++-- .../typespec-autorest/test/arm/arm.test.ts | 3 + .../lib/backcompat.tsp | 2 + .../lib/common-types/types.tsp | 34 +------- 5 files changed, 50 insertions(+), 82 deletions(-) diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index 6cbdb8f500..1d11512ab6 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -1135,13 +1135,11 @@ model Azure.ResourceManager.CommonTypes.Identity #### Properties -| Name | Type | Description | -| -------------- | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- | -| principalIdV3? | `string` | The principal ID of resource identity. | -| principalId? | `Core.uuid` | The principal ID of resource identity. The value must be an UUID. | -| tenantIdV3? | `string` | The tenant ID of resource. | -| tenantId? | `Core.uuid` | The tenant ID of resource. The value must be an UUID. | -| type? | [`ResourceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.ResourceIdentityType) | The identity type. | +| Name | Type | Description | +| ------------ | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- | +| principalId? | `Core.uuid` | The principal ID of resource identity. The value must be an UUID. | +| tenantId? | `Core.uuid` | The tenant ID of resource. The value must be an UUID. | +| type? | [`ResourceIdentityType`](./data-types.md#Azure.ResourceManager.CommonTypes.ResourceIdentityType) | The identity type. | ### `IfMatchHeader` {#Azure.ResourceManager.CommonTypes.IfMatchHeader} @@ -1547,13 +1545,12 @@ model Azure.ResourceManager.CommonTypes.Resource #### Properties -| Name | Type | Description | -| ----------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| idV3? | `string` | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} | -| id? | `Core.armResourceIdentifier` | Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" | -| name? | `string` | The name of the resource | -| type? | `string` | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | -| systemData? | [`SystemData`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemData) | Azure Resource Manager metadata containing createdBy and modifiedBy information. | +| Name | Type | Description | +| ----------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| id? | `Core.armResourceIdentifier` | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} | +| name? | `string` | The name of the resource | +| type? | `string` | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | +| systemData? | [`SystemData`](./data-types.md#Azure.ResourceManager.CommonTypes.SystemData) | Azure Resource Manager metadata containing createdBy and modifiedBy information. | ### `ResourceGroupNameParameter` {#Azure.ResourceManager.CommonTypes.ResourceGroupNameParameter} @@ -1630,10 +1627,9 @@ model Azure.ResourceManager.CommonTypes.SubscriptionIdParameter #### Properties -| Name | Type | Description | -| ---------------- | ----------- | ------------------------------------------------------------- | -| subscriptionIdV3 | `string` | The ID of the target subscription. | -| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| Name | Type | Description | +| -------------- | ----------- | ------------------------------------------------------------- | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | ### `SystemAssignedServiceIdentity` {#Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity} @@ -1890,7 +1886,6 @@ model Azure.ResourceManager.Foundations.DefaultBaseParameters | Name | Type | Description | | ----------------- | ----------- | ---------------------------------------------------------------------- | | apiVersion | `string` | The API version to use for this operation. | -| subscriptionIdV3 | `string` | The ID of the target subscription. | | subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | | location | `string` | The location name. | | resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | @@ -1943,12 +1938,11 @@ model Azure.ResourceManager.Foundations.LocationBaseParameters #### Properties -| Name | Type | Description | -| ---------------- | ----------- | ------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionIdV3 | `string` | The ID of the target subscription. | -| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | -| location | `string` | The location name. | +| Name | Type | Description | +| -------------- | ----------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| location | `string` | The location name. | ### `LocationScope` {#Azure.ResourceManager.Foundations.LocationScope} @@ -1966,13 +1960,12 @@ model Azure.ResourceManager.Foundations.LocationScope #### Properties -| Name | Type | Description | -| ---------------- | -------------------------------- | ------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionIdV3 | `string` | The ID of the target subscription. | -| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | -| location | `string` | The location name. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| Name | Type | Description | +| -------------- | -------------------------------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| location | `string` | The location name. | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `ProxyResourceUpdateModel` {#Azure.ResourceManager.Foundations.ProxyResourceUpdateModel} @@ -2008,7 +2001,6 @@ model Azure.ResourceManager.Foundations.ResourceGroupBaseParameters | Name | Type | Description | | ----------------- | ----------- | ------------------------------------------------------------- | | apiVersion | `string` | The API version to use for this operation. | -| subscriptionIdV3 | `string` | The ID of the target subscription. | | subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | | resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | @@ -2031,7 +2023,6 @@ model Azure.ResourceManager.Foundations.ResourceGroupScope | Name | Type | Description | | ----------------- | -------------------------------- | ---------------------------------------------------------------------- | | apiVersion | `string` | The API version to use for this operation. | -| subscriptionIdV3 | `string` | The ID of the target subscription. | | subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | | location | `string` | The location name. | | resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | @@ -2090,11 +2081,10 @@ model Azure.ResourceManager.Foundations.SubscriptionBaseParameters #### Properties -| Name | Type | Description | -| ---------------- | ----------- | ------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionIdV3 | `string` | The ID of the target subscription. | -| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| Name | Type | Description | +| -------------- | ----------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | ### `SubscriptionScope` {#Azure.ResourceManager.Foundations.SubscriptionScope} @@ -2112,12 +2102,11 @@ model Azure.ResourceManager.Foundations.SubscriptionScope #### Properties -| Name | Type | Description | -| ---------------- | -------------------------------- | ------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionIdV3 | `string` | The ID of the target subscription. | -| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| Name | Type | Description | +| -------------- | -------------------------------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `TagsUpdateModel` {#Azure.ResourceManager.Foundations.TagsUpdateModel} diff --git a/docs/libraries/azure-resource-manager/reference/interfaces.md b/docs/libraries/azure-resource-manager/reference/interfaces.md index 28b8f79fd8..bee0fa9964 100644 --- a/docs/libraries/azure-resource-manager/reference/interfaces.md +++ b/docs/libraries/azure-resource-manager/reference/interfaces.md @@ -200,7 +200,7 @@ op Azure.ResourceManager.ResourceCollectionOperations.listByParent(provider: "Mi #### `ResourceCollectionOperations.listBySubscription` {#Azure.ResourceManager.ResourceCollectionOperations.listBySubscription} ```typespec -op Azure.ResourceManager.ResourceCollectionOperations.listBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse +op Azure.ResourceManager.ResourceCollectionOperations.listBySubscription(apiVersion: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceCreateAsync` {#Azure.ResourceManager.ResourceCreateAsync} @@ -385,7 +385,7 @@ interface Azure.ResourceManager.ResourceListBySubscription #### `ResourceListBySubscription.listBySubscription` {#Azure.ResourceManager.ResourceListBySubscription.listBySubscription} ```typespec -op Azure.ResourceManager.ResourceListBySubscription.listBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse +op Azure.ResourceManager.ResourceListBySubscription.listBySubscription(apiVersion: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceOperations` {#Azure.ResourceManager.ResourceOperations} @@ -435,7 +435,7 @@ op Azure.ResourceManager.ResourceOperations.listByParent(provider: "Microsoft.Th #### `ResourceOperations.listBySubscription` {#Azure.ResourceManager.ResourceOperations.listBySubscription} ```typespec -op Azure.ResourceManager.ResourceOperations.listBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse +op Azure.ResourceManager.ResourceOperations.listBySubscription(apiVersion: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ResourceRead` {#Azure.ResourceManager.ResourceRead} @@ -604,7 +604,7 @@ op Azure.ResourceManager.TrackedResourceOperations.listByParent(provider: "Micro #### `TrackedResourceOperations.listBySubscription` {#Azure.ResourceManager.TrackedResourceOperations.listBySubscription} ```typespec -op Azure.ResourceManager.TrackedResourceOperations.listBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse +op Azure.ResourceManager.TrackedResourceOperations.listBySubscription(apiVersion: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse> | Azure.ResourceManager.CommonTypes.ErrorResponse ``` ### `ArmCustomPatchAsync` {#Azure.ResourceManager.ArmCustomPatchAsync} @@ -651,7 +651,7 @@ op Azure.ResourceManager.ArmCustomPatchSync(provider: "Microsoft.ThisWillBeRepla A resource list operation, at the subscription scope ```typespec -op Azure.ResourceManager.ArmListBySubscription(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Response | Error +op Azure.ResourceManager.ArmListBySubscription(apiVersion: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced"): Response | Error ``` #### Template Parameters @@ -1049,7 +1049,7 @@ op Azure.ResourceManager.ArmTagsPatchSync(provider: "Microsoft.ThisWillBeReplace ### `checkGlobalNameAvailability` {#Azure.ResourceManager.checkGlobalNameAvailability} ```typespec -op Azure.ResourceManager.checkGlobalNameAvailability(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced", body: Request): Response | Azure.ResourceManager.CommonTypes.ErrorResponse +op Azure.ResourceManager.checkGlobalNameAvailability(apiVersion: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced", body: Request): Response | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters @@ -1063,7 +1063,7 @@ op Azure.ResourceManager.checkGlobalNameAvailability(apiVersion: string, subscri ### `checkLocalNameAvailability` {#Azure.ResourceManager.checkLocalNameAvailability} ```typespec -op Azure.ResourceManager.checkLocalNameAvailability(apiVersion: string, subscriptionIdV3: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced", location: string, body: Request): Response | Azure.ResourceManager.CommonTypes.ErrorResponse +op Azure.ResourceManager.checkLocalNameAvailability(apiVersion: string, subscriptionId: Azure.Core.uuid, provider: "Microsoft.ThisWillBeReplaced", location: string, body: Request): Response | Azure.ResourceManager.CommonTypes.ErrorResponse ``` #### Template Parameters diff --git a/packages/typespec-autorest/test/arm/arm.test.ts b/packages/typespec-autorest/test/arm/arm.test.ts index b1c91404d2..35d3b5cfb5 100644 --- a/packages/typespec-autorest/test/arm/arm.test.ts +++ b/packages/typespec-autorest/test/arm/arm.test.ts @@ -121,6 +121,7 @@ it("can use private endpoints with common-types references", async () => { const openapi = await openApiFor( `@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) @armProviderNamespace + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) namespace Microsoft.PrivateLinkTest; interface Operations extends Azure.ResourceManager.Operations {} @@ -161,6 +162,7 @@ it("can use ResourceNameParameter for custom name parameter definition", async ( const openapi = await openApiFor( `@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) @armProviderNamespace + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) namespace Microsoft.PrivateLinkTest; interface Operations extends Azure.ResourceManager.Operations {} @@ -200,6 +202,7 @@ it("can use ResourceNameParameter for default name parameter definition", async const openapi = await openApiFor( `@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) @armProviderNamespace + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) namespace Microsoft.PrivateLinkTest; interface Operations extends Azure.ResourceManager.Operations {} diff --git a/packages/typespec-azure-resource-manager/lib/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/backcompat.tsp index 5b745a6329..57a60f2ac1 100644 --- a/packages/typespec-azure-resource-manager/lib/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/backcompat.tsp @@ -20,6 +20,8 @@ alias PrivateEndpointConnectionParameter = CommonTypes.PrivateEndpointConnection alias PrivateLinkResource = CommonTypes.PrivateLinkResource; alias PrivateLinkResourceProperties = CommonTypes.PrivateLinkResourceProperties; alias PrivateLinkResourceParameter = CommonTypes.PrivateLinkResourceParameter; +alias PrivateEndpointConnectionResourceListResult = CommonTypes.PrivateEndpointConnectionListResult; +alias PrivateLinkResourceListResult = CommonTypes.PrivateLinkResourceListResult; // types alias ErrorResponse = CommonTypes.ErrorResponse; diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index af1de64582..31d119c93a 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -13,13 +13,7 @@ namespace Azure.ResourceManager.CommonTypes; @extension("x-ms-azure-resource", true) model Resource { /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ - @renamedFrom(Versions.v4, "id") - @removed(Versions.v4) - @visibility("read") - idV3?: string; - - /** Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" */ - @added(CommonTypes.Versions.v4) + @typeChangedFrom(Versions.v4, string) @visibility("read") id?: armResourceIdentifier; @@ -348,25 +342,13 @@ union ResourceIdentityType { /** Identity for the resource. */ model Identity { - /** The principal ID of resource identity. */ - @renamedFrom(Versions.v4, "principalId") - @removed(Versions.v4) - @visibility("read") - principalIdV3?: string; - /** The principal ID of resource identity. The value must be an UUID. */ - @added(CommonTypes.Versions.v4) + @typeChangedFrom(Versions.v4, string) @visibility("read") principalId?: uuid; - /** The tenant ID of resource. */ - @renamedFrom(Versions.v4, "tenantId") - @removed(Versions.v4) - @visibility("read") - tenantIdV3?: string; - /** The tenant ID of resource. The value must be an UUID. */ - @added(CommonTypes.Versions.v4) + @typeChangedFrom(Versions.v4, string) @visibility("read") tenantId?: uuid; @@ -523,15 +505,7 @@ model ResourceGroupNameParameter { */ @doc("The default subscriptionId parameter type.") model SubscriptionIdParameter { - @renamedFrom(Versions.v4, "subscriptionId") - @removed(Versions.v4) - @path - @minLength(1) - @segment("subscriptions") - @doc("The ID of the target subscription.") - subscriptionIdV3: string; - - @added(Versions.v4) + @typeChangedFrom(Versions.v4, string) @path @segment("subscriptions") @doc("The ID of the target subscription. The value must be an UUID.") From 2f4df976e2348f884b7e50ef21ee91ee2d272828 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 7 Jun 2024 14:24:35 -0700 Subject: [PATCH 16/25] Adding sample spec to test envelope properties --- .../common-properties/main.tsp | 64 ++ .../encryption/main.tsp | 2 +- .../managed-identity/main.tsp | 58 ++ .../typespec-autorest/openapi.json | 550 ++++++++++++++++++ .../typespec-autorest/openapi.json | 479 +++++++++++++++ .../lib/common-types/types-ref.tsp | 16 + .../lib/common-types/types.tsp | 1 + .../lib/decorators.tsp | 2 +- 8 files changed, 1170 insertions(+), 2 deletions(-) create mode 100644 packages/samples/specs/resource-manager/resource-common-properties/common-properties/main.tsp create mode 100644 packages/samples/specs/resource-manager/resource-common-properties/managed-identity/main.tsp create mode 100644 packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/openapi.json create mode 100644 packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/openapi.json diff --git a/packages/samples/specs/resource-manager/resource-common-properties/common-properties/main.tsp b/packages/samples/specs/resource-manager/resource-common-properties/common-properties/main.tsp new file mode 100644 index 0000000000..bc38bafecb --- /dev/null +++ b/packages/samples/specs/resource-manager/resource-common-properties/common-properties/main.tsp @@ -0,0 +1,64 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.ResourceManager; +using Azure.Core; + +@armProviderNamespace("Contoso.CommonEnvelopePropertiesExample") +@service({ + title: "Contoso.CommonEnvelopePropertiesExample", +}) +@OpenAPI.info({ + version: "2023-03-01-preview", +}) +@doc("An example of using some of common envelope and property bag properties in a resource type. Their names are all end with 'Property'.") +@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) +namespace Microsoft.UpdateTests; + +interface Operations extends Azure.ResourceManager.Operations {} + +@doc("Widget Resource") +model WidgetResource is TrackedResource { + @pattern("^[a-zA-Z0-9-]{3,24}$") + @doc("The name of the widget.") + @key("widgetName") + @segment("widgets") + @path + name: string; + + ...ExtendedLocationProperty; + ...ManagedByProperty; +} + +@doc("Widget Resource Properties.") +model WidgetResourceProperties { + @doc("The widget color.") + @visibility("create", "read") + color: string; + + /** Provisioning state */ + @visibility("read") + provisioningState?: ResourceProvisioningState; + + ...EntityTagProperty; + ...ResourceKindProperty; + ...ResourcePlanProperty; + ...ResourceSkuProperty; +} + +@armResourceOperations +interface Widgets { + get is ArmResourceRead; + create is ArmResourceCreateOrUpdateAsync; + update is ArmTagsPatchSync; + delete is ArmResourceDeleteWithoutOkAsync; + listByResourceGroup is ArmResourceListByParent; + listBySubscription is ArmListBySubscription; +} diff --git a/packages/samples/specs/resource-manager/resource-common-properties/encryption/main.tsp b/packages/samples/specs/resource-manager/resource-common-properties/encryption/main.tsp index a1cc373bd2..2dc3e955b1 100644 --- a/packages/samples/specs/resource-manager/resource-common-properties/encryption/main.tsp +++ b/packages/samples/specs/resource-manager/resource-common-properties/encryption/main.tsp @@ -44,7 +44,7 @@ model WidgetResourceProperties { @visibility("read") provisioningState?: ResourceProvisioningState; - ...Encryption; + ...EncryptionProperty; } @armResourceOperations diff --git a/packages/samples/specs/resource-manager/resource-common-properties/managed-identity/main.tsp b/packages/samples/specs/resource-manager/resource-common-properties/managed-identity/main.tsp new file mode 100644 index 0000000000..ce69a3fd33 --- /dev/null +++ b/packages/samples/specs/resource-manager/resource-common-properties/managed-identity/main.tsp @@ -0,0 +1,58 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.ResourceManager; +using Azure.Core; + +@armProviderNamespace("Contoso.ManagedIdentityExample") +@service({ + title: "Contoso.ManagedIdentityExample", +}) +@OpenAPI.info({ + version: "2023-03-01-preview", +}) +@doc("An example of using the ManagedIdentity properties in a resource type.") +@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) +namespace Microsoft.UpdateTests; + +interface Operations extends Azure.ResourceManager.Operations {} + +@doc("Widget Resource") +model WidgetResource is TrackedResource { + @pattern("^[a-zA-Z0-9-]{3,24}$") + @doc("The name of the widget.") + @key("widgetName") + @segment("widgets") + @path + name: string; + + ...ManagedServiceIdentityProperty; // Or ...ManagedSystemAssignedIdentityProperty; +} + +@doc("Widget Resource Properties.") +model WidgetResourceProperties { + @doc("The widget color.") + @visibility("create", "read") + color: string; + + /** Provisioning state */ + @visibility("read") + provisioningState?: ResourceProvisioningState; +} + +@armResourceOperations +interface Widgets { + get is ArmResourceRead; + create is ArmResourceCreateOrUpdateAsync; + update is ArmTagsPatchSync; + delete is ArmResourceDeleteWithoutOkAsync; + listByResourceGroup is ArmResourceListByParent; + listBySubscription is ArmListBySubscription; +} diff --git a/packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/openapi.json new file mode 100644 index 0000000000..09315c6220 --- /dev/null +++ b/packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/openapi.json @@ -0,0 +1,550 @@ +{ + "swagger": "2.0", + "info": { + "title": "Contoso.CommonEnvelopePropertiesExample", + "version": "2023-03-01-preview", + "description": "An example of using some of common envelope and property bag properties in a resource type. Their names are all end with 'Property'.", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "host": "management.azure.com", + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow.", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "tags": [ + { + "name": "Operations" + }, + { + "name": "Widgets" + } + ], + "paths": { + "/providers/Contoso.CommonEnvelopePropertiesExample/operations": { + "get": { + "operationId": "Operations_List", + "tags": [ + "Operations" + ], + "description": "List the operations for the provider", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Contoso.CommonEnvelopePropertiesExample/widgets": { + "get": { + "operationId": "Widgets_ListBySubscription", + "tags": [ + "Widgets" + ], + "description": "List WidgetResource resources by subscription ID", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/WidgetResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Contoso.CommonEnvelopePropertiesExample/widgets": { + "get": { + "operationId": "Widgets_ListByResourceGroup", + "tags": [ + "Widgets" + ], + "description": "List WidgetResource resources by resource group", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/WidgetResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Contoso.CommonEnvelopePropertiesExample/widgets/{widgetName}": { + "get": { + "operationId": "Widgets_Get", + "tags": [ + "Widgets" + ], + "description": "Get a WidgetResource", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "widgetName", + "in": "path", + "description": "The name of the widget.", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/WidgetResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "operationId": "Widgets_Create", + "tags": [ + "Widgets" + ], + "description": "Create a WidgetResource", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "widgetName", + "in": "path", + "description": "The name of the widget.", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/WidgetResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'WidgetResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/WidgetResource" + } + }, + "201": { + "description": "Resource 'WidgetResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/WidgetResource" + }, + "headers": { + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "Widgets_Update", + "tags": [ + "Widgets" + ], + "description": "Update a WidgetResource", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "widgetName", + "in": "path", + "description": "The name of the widget.", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/WidgetResourceTagsUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/WidgetResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "operationId": "Widgets_Delete", + "tags": [ + "Widgets" + ], + "description": "Delete a WidgetResource", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "widgetName", + "in": "path", + "description": "The name of the widget.", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + } + }, + "definitions": { + "Azure.ResourceManager.CommonTypes.ExtendedLocation": { + "type": "object", + "description": "The complex type of the extended location.", + "properties": { + "name": { + "type": "string", + "description": "The name of the extended location." + }, + "type": { + "$ref": "#/definitions/Azure.ResourceManager.CommonTypes.ExtendedLocationType", + "description": "The type of the extended location." + } + }, + "required": [ + "name", + "type" + ] + }, + "Azure.ResourceManager.CommonTypes.ExtendedLocationType": { + "type": "string", + "description": "The supported ExtendedLocation types.", + "enum": [ + "EdgeZone", + "CustomLocation" + ], + "x-ms-enum": { + "name": "ExtendedLocationType", + "modelAsString": true, + "values": [ + { + "name": "EdgeZone", + "value": "EdgeZone", + "description": "Azure Edge Zones location type" + }, + { + "name": "CustomLocation", + "value": "CustomLocation", + "description": "Azure Custom Locations type" + } + ] + } + }, + "Azure.ResourceManager.ResourceProvisioningState": { + "type": "string", + "description": "The provisioning state of a resource type.", + "enum": [ + "Succeeded", + "Failed", + "Canceled" + ], + "x-ms-enum": { + "name": "ResourceProvisioningState", + "modelAsString": true, + "values": [ + { + "name": "Succeeded", + "value": "Succeeded", + "description": "Resource has been created." + }, + { + "name": "Failed", + "value": "Failed", + "description": "Resource creation failed." + }, + { + "name": "Canceled", + "value": "Canceled", + "description": "Resource creation was canceled." + } + ] + }, + "readOnly": true + }, + "WidgetResource": { + "type": "object", + "description": "Widget Resource", + "properties": { + "properties": { + "$ref": "#/definitions/WidgetResourceProperties", + "description": "The resource-specific properties for this resource.", + "x-ms-client-flatten": true, + "x-ms-mutability": [ + "read", + "create" + ] + }, + "extendedLocation": { + "$ref": "#/definitions/Azure.ResourceManager.CommonTypes.ExtendedLocation", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "managedBy": { + "type": "string", + "description": "The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource." + } + }, + "allOf": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" + } + ] + }, + "WidgetResourceListResult": { + "type": "object", + "description": "The response of a WidgetResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The WidgetResource items on this page", + "items": { + "$ref": "#/definitions/WidgetResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "WidgetResourceProperties": { + "type": "object", + "description": "Widget Resource Properties.", + "properties": { + "color": { + "type": "string", + "description": "The widget color.", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "provisioningState": { + "$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState", + "description": "Provisioning state", + "readOnly": true + }, + "eTag": { + "type": "string", + "description": "If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.", + "readOnly": true + }, + "kind": { + "type": "string", + "description": "Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.", + "pattern": "^[-\\w\\._,\\(\\\\\\)]+$", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "plan": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/Plan", + "description": "Details of the resource plan." + }, + "sku": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/Sku", + "description": "The SKU (Stock Keeping Unit) assigned to this resource." + } + }, + "required": [ + "color" + ] + }, + "WidgetResourceTagsUpdate": { + "type": "object", + "description": "The type used for updating tags in WidgetResource resources.", + "properties": { + "tags": { + "type": "object", + "description": "Resource tags.", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "parameters": {} +} diff --git a/packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/openapi.json new file mode 100644 index 0000000000..8c944ba583 --- /dev/null +++ b/packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/openapi.json @@ -0,0 +1,479 @@ +{ + "swagger": "2.0", + "info": { + "title": "Contoso.ManagedIdentityExample", + "version": "2023-03-01-preview", + "description": "An example of using the ManagedIdentity properties in a resource type.", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "host": "management.azure.com", + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow.", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "tags": [ + { + "name": "Operations" + }, + { + "name": "Widgets" + } + ], + "paths": { + "/providers/Contoso.ManagedIdentityExample/operations": { + "get": { + "operationId": "Operations_List", + "tags": [ + "Operations" + ], + "description": "List the operations for the provider", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Contoso.ManagedIdentityExample/widgets": { + "get": { + "operationId": "Widgets_ListBySubscription", + "tags": [ + "Widgets" + ], + "description": "List WidgetResource resources by subscription ID", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/WidgetResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Contoso.ManagedIdentityExample/widgets": { + "get": { + "operationId": "Widgets_ListByResourceGroup", + "tags": [ + "Widgets" + ], + "description": "List WidgetResource resources by resource group", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/WidgetResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Contoso.ManagedIdentityExample/widgets/{widgetName}": { + "get": { + "operationId": "Widgets_Get", + "tags": [ + "Widgets" + ], + "description": "Get a WidgetResource", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "widgetName", + "in": "path", + "description": "The name of the widget.", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/WidgetResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "operationId": "Widgets_Create", + "tags": [ + "Widgets" + ], + "description": "Create a WidgetResource", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "widgetName", + "in": "path", + "description": "The name of the widget.", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/WidgetResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'WidgetResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/WidgetResource" + } + }, + "201": { + "description": "Resource 'WidgetResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/WidgetResource" + }, + "headers": { + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "Widgets_Update", + "tags": [ + "Widgets" + ], + "description": "Update a WidgetResource", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "widgetName", + "in": "path", + "description": "The name of the widget.", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/WidgetResourceTagsUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/WidgetResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "operationId": "Widgets_Delete", + "tags": [ + "Widgets" + ], + "description": "Delete a WidgetResource", + "parameters": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "widgetName", + "in": "path", + "description": "The name of the widget.", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + } + }, + "definitions": { + "Azure.ResourceManager.ResourceProvisioningState": { + "type": "string", + "description": "The provisioning state of a resource type.", + "enum": [ + "Succeeded", + "Failed", + "Canceled" + ], + "x-ms-enum": { + "name": "ResourceProvisioningState", + "modelAsString": true, + "values": [ + { + "name": "Succeeded", + "value": "Succeeded", + "description": "Resource has been created." + }, + { + "name": "Failed", + "value": "Failed", + "description": "Resource creation failed." + }, + { + "name": "Canceled", + "value": "Canceled", + "description": "Resource creation was canceled." + } + ] + }, + "readOnly": true + }, + "WidgetResource": { + "type": "object", + "description": "Widget Resource", + "properties": { + "properties": { + "$ref": "#/definitions/WidgetResourceProperties", + "description": "The resource-specific properties for this resource.", + "x-ms-client-flatten": true, + "x-ms-mutability": [ + "read", + "create" + ] + }, + "identity": { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/managedidentity.json#/definitions/ManagedServiceIdentity", + "description": "The managed service identities assigned to this resource." + } + }, + "allOf": [ + { + "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" + } + ] + }, + "WidgetResourceListResult": { + "type": "object", + "description": "The response of a WidgetResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The WidgetResource items on this page", + "items": { + "$ref": "#/definitions/WidgetResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "WidgetResourceProperties": { + "type": "object", + "description": "Widget Resource Properties.", + "properties": { + "color": { + "type": "string", + "description": "The widget color.", + "x-ms-mutability": [ + "read", + "create" + ] + }, + "provisioningState": { + "$ref": "#/definitions/Azure.ResourceManager.ResourceProvisioningState", + "description": "Provisioning state", + "readOnly": true + } + }, + "required": [ + "color" + ] + }, + "WidgetResourceTagsUpdate": { + "type": "object", + "description": "The type used for updating tags in WidgetResource resources.", + "properties": { + "tags": { + "type": "object", + "description": "Resource tags.", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "parameters": {} +} diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp index d2bd98898c..b08e464990 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp @@ -189,6 +189,22 @@ namespace Azure.ResourceManager.CommonTypes; @@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v4); @@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v5); +/** + * ResourceModelWithAllowedPropertySet + */ +@@armCommonDefinition(ResourceModelWithAllowedPropertySet, + "ResourceModelWithAllowedPropertySet", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(ResourceModelWithAllowedPropertySet, + "ResourceModelWithAllowedPropertySet", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(ResourceModelWithAllowedPropertySet, + "ResourceModelWithAllowedPropertySet", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + /** * The check availability request body. */ diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 31d119c93a..7119ac8a10 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -72,6 +72,7 @@ model ResourceModelWithAllowedPropertySet extends TrackedResource { /** Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. * If supported, the resource provider must validate and persist this value. */ @pattern("^[-\\w\\._,\\(\\)]+$") + @visibility("read", "create") kind?: string; /** The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. diff --git a/packages/typespec-azure-resource-manager/lib/decorators.tsp b/packages/typespec-azure-resource-manager/lib/decorators.tsp index 2781366d97..6923f09652 100644 --- a/packages/typespec-azure-resource-manager/lib/decorators.tsp +++ b/packages/typespec-azure-resource-manager/lib/decorators.tsp @@ -180,7 +180,7 @@ extern dec armResourceOperations(target: Interface, _?: unknown); * This decorator is used either on a namespace or a version enum value to indicate * the version of the Azure Resource Manager common-types to use for refs in emitted Swagger files. * - * @param version The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. + * @param version The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version or an equivalent string value like "v5". */ extern dec armCommonTypesVersion( target: Namespace | EnumMember, From 656a3f9acacdb86d6504ecac890fde8eeea4c5a5 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 7 Jun 2024 15:18:05 -0700 Subject: [PATCH 17/25] Fully synced the armCommonDefinitions and Parameters --- .../reference/data-types.md | 62 ++---- .../reference/decorators.md | 6 +- .../reference/index.mdx | 8 +- .../typespec-azure-resource-manager/README.md | 6 +- .../customer-managed-keys-ref.tsp | 13 +- .../lib/common-types/private-links-ref.tsp | 106 ++++++++++- .../lib/common-types/types-ref.tsp | 178 ++++++++++++++---- .../lib/common-types/types.tsp | 20 +- .../lib/foundations/backcompat.tsp | 2 +- .../lib/parameters.tsp | 44 +---- 10 files changed, 305 insertions(+), 140 deletions(-) diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index 1d11512ab6..a73dc5876d 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -512,20 +512,6 @@ model Azure.ResourceManager.LocationParameter | -------- | -------- | ------------------ | | location | `string` | The location name. | -### `LocationResourceParameter` {#Azure.ResourceManager.LocationResourceParameter} - -The default location parameter type. - -```typespec -model Azure.ResourceManager.LocationResourceParameter -``` - -#### Properties - -| Name | Type | Description | -| -------- | -------- | ------------------ | -| location | `string` | The location name. | - ### `ManagedByProperty` {#Azure.ResourceManager.ManagedByProperty} Model representing the standard `managedBy` envelope property for a resource. @@ -674,20 +660,6 @@ model Azure.ResourceManager.ResourceGroupLocationResource | -------- | -------- | ------------------ | | location | `string` | The location name. | -### `ResourceGroupParameter` {#Azure.ResourceManager.ResourceGroupParameter} - -The default resource group parameter type. - -```typespec -model Azure.ResourceManager.ResourceGroupParameter -``` - -#### Properties - -| Name | Type | Description | -| ----------------- | -------- | ------------------------------------------------------------- | -| resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | - ### `ResourceInstanceParameters` {#Azure.ResourceManager.ResourceInstanceParameters} The dynamic parameters of a resource instance - pass in the proper base type to indicate @@ -1036,12 +1008,12 @@ model Azure.ResourceManager.CommonTypes.Encryption | infrastructureEncryption? | [`InfrastructureEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.InfrastructureEncryption) | Values are enabled and disabled. | | customerManagedKeyEncryption? | [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption) | All Customer-managed key encryption properties for the resource. | -### `encryptionProperties` {#Azure.ResourceManager.CommonTypes.encryptionProperties} +### `EncryptionProperties` {#Azure.ResourceManager.CommonTypes.EncryptionProperties} Configuration of key for data encryption ```typespec -model Azure.ResourceManager.CommonTypes.encryptionProperties +model Azure.ResourceManager.CommonTypes.EncryptionProperties ``` #### Properties @@ -1113,18 +1085,6 @@ model Azure.ResourceManager.CommonTypes.ExtendedLocation | name | `string` | The name of the extended location. | | type | [`ExtendedLocationType`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtendedLocationType) | The type of the extended location. | -### `ExtensionResource` {#Azure.ResourceManager.CommonTypes.ExtensionResource} - -The base extension resource. - -```typespec -model Azure.ResourceManager.CommonTypes.ExtensionResource -``` - -#### Properties - -None - ### `Identity` {#Azure.ResourceManager.CommonTypes.Identity} Identity for the resource. @@ -1199,12 +1159,12 @@ model Azure.ResourceManager.CommonTypes.KeyVaultProperties | keyIdentifier? | `string` | Key vault uri to access the encryption key. | | identity? | `string` | The client ID of the identity which will be used to access key vault. | -### `locationData` {#Azure.ResourceManager.CommonTypes.locationData} +### `LocationData` {#Azure.ResourceManager.CommonTypes.LocationData} Metadata pertaining to the geographic location of the resource. ```typespec -model Azure.ResourceManager.CommonTypes.locationData +model Azure.ResourceManager.CommonTypes.LocationData ``` #### Properties @@ -1230,6 +1190,20 @@ model Azure.ResourceManager.CommonTypes.LocationParameter | -------- | -------- | ------------------------- | | location | `string` | The name of Azure region. | +### `LocationResourceParameter` {#Azure.ResourceManager.CommonTypes.LocationResourceParameter} + +The default location parameter type. + +```typespec +model Azure.ResourceManager.CommonTypes.LocationResourceParameter +``` + +#### Properties + +| Name | Type | Description | +| -------- | -------- | ------------------ | +| location | `string` | The location name. | + ### `ManagedServiceIdentity` {#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity} Managed service identity (system assigned and/or user assigned identities) diff --git a/docs/libraries/azure-resource-manager/reference/decorators.md b/docs/libraries/azure-resource-manager/reference/decorators.md index ee1d42158a..9983be00ac 100644 --- a/docs/libraries/azure-resource-manager/reference/decorators.md +++ b/docs/libraries/azure-resource-manager/reference/decorators.md @@ -23,9 +23,9 @@ the version of the Azure Resource Manager common-types to use for refs in emitte #### Parameters -| Name | Type | Description | -| ------- | ------------------------------ | ------------------------------------------------------------------------------------ | -| version | `valueof string \| EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. | +| Name | Type | Description | +| ------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | +| version | `valueof string \| EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version or an equivalent string value like "v5". | ### `@armLibraryNamespace` {#@Azure.ResourceManager.armLibraryNamespace} diff --git a/docs/libraries/azure-resource-manager/reference/index.mdx b/docs/libraries/azure-resource-manager/reference/index.mdx index 563dfda1d7..b865165719 100644 --- a/docs/libraries/azure-resource-manager/reference/index.mdx +++ b/docs/libraries/azure-resource-manager/reference/index.mdx @@ -141,7 +141,6 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ExtensionResource`](./data-types.md#Azure.ResourceManager.ExtensionResource) - [`KeysOf`](./data-types.md#Azure.ResourceManager.KeysOf) - [`LocationParameter`](./data-types.md#Azure.ResourceManager.LocationParameter) -- [`LocationResourceParameter`](./data-types.md#Azure.ResourceManager.LocationResourceParameter) - [`ManagedByProperty`](./data-types.md#Azure.ResourceManager.ManagedByProperty) - [`ManagedServiceIdentityProperty`](./data-types.md#Azure.ResourceManager.ManagedServiceIdentityProperty) - [`ManagedSystemAssignedIdentityProperty`](./data-types.md#Azure.ResourceManager.ManagedSystemAssignedIdentityProperty) @@ -149,7 +148,6 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ProviderNamespace`](./data-types.md#Azure.ResourceManager.ProviderNamespace) - [`ProxyResource`](./data-types.md#Azure.ResourceManager.ProxyResource) - [`ResourceGroupLocationResource`](./data-types.md#Azure.ResourceManager.ResourceGroupLocationResource) -- [`ResourceGroupParameter`](./data-types.md#Azure.ResourceManager.ResourceGroupParameter) - [`ResourceInstanceParameters`](./data-types.md#Azure.ResourceManager.ResourceInstanceParameters) - [`ResourceKindProperty`](./data-types.md#Azure.ResourceManager.ResourceKindProperty) - [`ResourceListResult`](./data-types.md#Azure.ResourceManager.ResourceListResult) @@ -172,19 +170,19 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`CheckNameAvailabilityResponse`](./data-types.md#Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse) - [`CustomerManagedKeyEncryption`](./data-types.md#Azure.ResourceManager.CommonTypes.CustomerManagedKeyEncryption) - [`Encryption`](./data-types.md#Azure.ResourceManager.CommonTypes.Encryption) -- [`encryptionProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.encryptionProperties) +- [`EncryptionProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.EncryptionProperties) - [`ErrorAdditionalInfo`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo) - [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) - [`ErrorResponse`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorResponse) - [`ExtendedLocation`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtendedLocation) -- [`ExtensionResource`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtensionResource) - [`Identity`](./data-types.md#Azure.ResourceManager.CommonTypes.Identity) - [`IfMatchHeader`](./data-types.md#Azure.ResourceManager.CommonTypes.IfMatchHeader) - [`IfNoneMatchHeader`](./data-types.md#Azure.ResourceManager.CommonTypes.IfNoneMatchHeader) - [`KeyEncryptionKeyIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyEncryptionKeyIdentity) - [`KeyVaultProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.KeyVaultProperties) -- [`locationData`](./data-types.md#Azure.ResourceManager.CommonTypes.locationData) +- [`LocationData`](./data-types.md#Azure.ResourceManager.CommonTypes.LocationData) - [`LocationParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.LocationParameter) +- [`LocationResourceParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.LocationResourceParameter) - [`ManagedServiceIdentity`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity) - [`ManagementGroupNameParameter`](./data-types.md#Azure.ResourceManager.CommonTypes.ManagementGroupNameParameter) - [`Operation`](./data-types.md#Azure.ResourceManager.CommonTypes.Operation) diff --git a/packages/typespec-azure-resource-manager/README.md b/packages/typespec-azure-resource-manager/README.md index 5c1b20fd24..703b9022a6 100644 --- a/packages/typespec-azure-resource-manager/README.md +++ b/packages/typespec-azure-resource-manager/README.md @@ -103,9 +103,9 @@ the version of the Azure Resource Manager common-types to use for refs in emitte ##### Parameters -| Name | Type | Description | -| ------- | ------------------------------ | ------------------------------------------------------------------------------------ | -| version | `valueof string \| EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version. | +| Name | Type | Description | +| ------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | +| version | `valueof string \| EnumMember` | The Azure.ResourceManager.CommonTypes.Versions for the desired common-types version or an equivalent string value like "v5". | #### `@armLibraryNamespace` diff --git a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp index 617b7375f5..3df1e5168a 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/customer-managed-keys-ref.tsp @@ -6,7 +6,7 @@ namespace Azure.ResourceManager.CommonTypes; @@armCommonDefinition(Encryption, "encryption", - Azure.ResourceManager.CommonTypes.Versions.v4, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, "customermanagedkeys.json" ); @@armCommonDefinition(Encryption, @@ -14,3 +14,14 @@ namespace Azure.ResourceManager.CommonTypes; Azure.ResourceManager.CommonTypes.Versions.v5, "customermanagedkeys.json" ); + +@@armCommonDefinition(CustomerManagedKeyEncryption, + "customerManagedKeyEncryption", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + "customermanagedkeys.json" +); +@@armCommonDefinition(CustomerManagedKeyEncryption, + "customerManagedKeyEncryption", + Azure.ResourceManager.CommonTypes.Versions.v5, + "customermanagedkeys.json" +); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp index c1f5c6c1ed..2fca19e18d 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/private-links-ref.tsp @@ -4,14 +4,53 @@ using Azure.ResourceManager.CommonTypes.Private; namespace Azure.ResourceManager.CommonTypes; -/** The private endpoint resource */ +/** The private endpoint */ @@armCommonDefinition(PrivateEndpoint, "PrivateEndpoint", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, "privatelinks.json" ); @@armCommonDefinition(PrivateEndpoint, "PrivateEndpoint", + Azure.ResourceManager.CommonTypes.Versions.v4, + "privatelinks.json" +); +@@armCommonDefinition(PrivateEndpoint, + "PrivateEndpoint", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); + +/** The private endpoint resource */ +@@armCommonDefinition(PrivateLinkResource, + "PrivateLinkResource", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition(PrivateLinkResource, + "PrivateLinkResource", + Azure.ResourceManager.CommonTypes.Versions.v4, + "privatelinks.json" +); +@@armCommonDefinition(PrivateLinkResource, + "PrivateLinkResource", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); + +/** PrivateEndpointConnection */ +@@armCommonDefinition(PrivateEndpointConnection, + "PrivateEndpointConnection", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition(PrivateEndpointConnection, + "PrivateEndpointConnection", + Azure.ResourceManager.CommonTypes.Versions.v4, + "privatelinks.json" +); +@@armCommonDefinition(PrivateEndpointConnection, + "PrivateEndpointConnection", Azure.ResourceManager.CommonTypes.Versions.v5, "privatelinks.json" ); @@ -19,7 +58,12 @@ namespace Azure.ResourceManager.CommonTypes; /** Properties of he private endpoint connection resource */ @@armCommonDefinition(PrivateEndpointConnectionProperties, "PrivateEndpointConnectionProperties", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition(PrivateEndpointConnectionProperties, + "PrivateEndpointConnectionProperties", + Azure.ResourceManager.CommonTypes.Versions.v4, "privatelinks.json" ); @@armCommonDefinition(PrivateEndpointConnectionProperties, @@ -31,7 +75,12 @@ namespace Azure.ResourceManager.CommonTypes; /** A collection of information about the state of the connection between service consumer and provider. */ @@armCommonDefinition(PrivateLinkServiceConnectionState, "PrivateLinkServiceConnectionState", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition(PrivateLinkServiceConnectionState, + "PrivateLinkServiceConnectionState", + Azure.ResourceManager.CommonTypes.Versions.v4, "privatelinks.json" ); @@armCommonDefinition(PrivateLinkServiceConnectionState, @@ -44,7 +93,12 @@ namespace Azure.ResourceManager.CommonTypes; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Matches current common code" @@armCommonDefinition(PrivateLinkResourceProperties, "PrivateLinkResourceProperties", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition(PrivateLinkResourceProperties, + "PrivateLinkResourceProperties", + Azure.ResourceManager.CommonTypes.Versions.v4, "privatelinks.json" ); @@armCommonDefinition(PrivateLinkResourceProperties, @@ -53,9 +107,49 @@ namespace Azure.ResourceManager.CommonTypes; "privatelinks.json" ); +/** PrivateEndpointConnectionListResult */ +@@armCommonDefinition(PrivateEndpointConnectionListResult, + "PrivateEndpointConnectionListResult", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition(PrivateEndpointConnectionListResult, + "PrivateEndpointConnectionListResult", + Azure.ResourceManager.CommonTypes.Versions.v4, + "privatelinks.json" +); +@@armCommonDefinition(PrivateEndpointConnectionListResult, + "PrivateEndpointConnectionListResult", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); + +/** PrivateLinkResourceListResult */ +@@armCommonDefinition(PrivateLinkResourceListResult, + "PrivateLinkResourceListResult", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "privatelinks.json" +); +@@armCommonDefinition(PrivateLinkResourceListResult, + "PrivateLinkResourceListResult", + Azure.ResourceManager.CommonTypes.Versions.v4, + "privatelinks.json" +); +@@armCommonDefinition(PrivateLinkResourceListResult, + "PrivateLinkResourceListResult", + Azure.ResourceManager.CommonTypes.Versions.v5, + "privatelinks.json" +); + +/** PrivateEndpointConnectionParameter */ +@@CommonTypes.Private.armCommonParameter(PrivateEndpointConnectionParameter.name, + "PrivateEndpointConnectionName", + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "privatelinks.json" +); @@CommonTypes.Private.armCommonParameter(PrivateEndpointConnectionParameter.name, "PrivateEndpointConnectionName", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + Azure.ResourceManager.CommonTypes.Versions.v4, "privatelinks.json" ); @@CommonTypes.Private.armCommonParameter(PrivateEndpointConnectionParameter.name, diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp index b08e464990..bf88692219 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp @@ -58,22 +58,6 @@ namespace Azure.ResourceManager.CommonTypes; Azure.ResourceManager.CommonTypes.Versions.v5 ); -/** - * The base extension resource. - */ -@@armCommonDefinition(ExtensionResource, - "ProxyResource", - Azure.ResourceManager.CommonTypes.Versions.v3 -); -@@armCommonDefinition(ExtensionResource, - "ProxyResource", - Azure.ResourceManager.CommonTypes.Versions.v4 -); -@@armCommonDefinition(ExtensionResource, - "ProxyResource", - Azure.ResourceManager.CommonTypes.Versions.v5 -); - /** * The SKU (Stock Keeping Unit) assigned to this resource. */ @@ -137,20 +121,11 @@ namespace Azure.ResourceManager.CommonTypes; ); /** - * The default operationId parameter type. + * locationData */ -@@armCommonDefinition(OperationIdParameter, - "OperationIdParameter", - Azure.ResourceManager.CommonTypes.Versions.v3 -); -@@armCommonDefinition(OperationIdParameter, - "OperationIdParameter", - Azure.ResourceManager.CommonTypes.Versions.v4 -); -@@armCommonDefinition(OperationIdParameter, - "OperationIdParameter", - Azure.ResourceManager.CommonTypes.Versions.v5 -); +@@armCommonDefinition(LocationData, "locationData", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(LocationData, "locationData", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(LocationData, "locationData", Azure.ResourceManager.CommonTypes.Versions.v5); /** * The error detail. @@ -175,6 +150,13 @@ namespace Azure.ResourceManager.CommonTypes; Azure.ResourceManager.CommonTypes.Versions.v5 ); +/** + * Identity + */ +@@armCommonDefinition(Identity, "Identity", Azure.ResourceManager.CommonTypes.Versions.v3); +@@armCommonDefinition(Identity, "Identity", Azure.ResourceManager.CommonTypes.Versions.v4); +@@armCommonDefinition(Identity, "Identity", Azure.ResourceManager.CommonTypes.Versions.v5); + /** * Metadata pertaining to creation and last modification of the resource. */ @@ -189,6 +171,38 @@ namespace Azure.ResourceManager.CommonTypes; @@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v4); @@armCommonDefinition(Plan, "Plan", Azure.ResourceManager.CommonTypes.Versions.v5); +/** + * encryptionProperties + */ +@@armCommonDefinition(EncryptionProperties, + "encryptionProperties", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(EncryptionProperties, + "encryptionProperties", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(EncryptionProperties, + "encryptionProperties", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + +/** + * KeyVaultProperties + */ +@@armCommonDefinition(KeyVaultProperties, + "KeyVaultProperties", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(KeyVaultProperties, + "KeyVaultProperties", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(KeyVaultProperties, + "KeyVaultProperties", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + /** * ResourceModelWithAllowedPropertySet */ @@ -237,6 +251,21 @@ namespace Azure.ResourceManager.CommonTypes; Azure.ResourceManager.CommonTypes.Versions.v5 ); +@@armCommonDefinition(ErrorResponse, + "ErrorResponse", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(ErrorResponse, + "ErrorResponse", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(ErrorResponse, + "ErrorResponse", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + +// -- Parameters +/** ApiVersionParameter */ @@armCommonParameter(ApiVersionParameter.apiVersion, "ApiVersionParameter", Azure.ResourceManager.CommonTypes.Versions.v3 @@ -260,6 +289,7 @@ namespace Azure.ResourceManager.CommonTypes; ] ); +/** SubscriptionIdParameter */ @@armCommonParameter(SubscriptionIdParameter.subscriptionId, "SubscriptionIdParameter", Azure.ResourceManager.CommonTypes.Versions.v3 @@ -276,15 +306,93 @@ namespace Azure.ResourceManager.CommonTypes; [ResourceHome.ResourceGroup, ResourceHome.Subscription, ResourceHome.Location] ); -@@armCommonDefinition(ErrorResponse, - "ErrorResponse", +/** ResourceGroupNameParameter */ +@@armCommonParameter(ResourceGroupNameParameter.resourceGroupName, + "ResourceGroupNameParameter", Azure.ResourceManager.CommonTypes.Versions.v3 ); -@@armCommonDefinition(ErrorResponse, - "ErrorResponse", +@@armCommonParameter(ResourceGroupNameParameter.resourceGroupName, + "ResourceGroupNameParameter", Azure.ResourceManager.CommonTypes.Versions.v4 ); -@@armCommonDefinition(ErrorResponse, - "ErrorResponse", +@@armCommonParameter(ResourceGroupNameParameter.resourceGroupName, + "ResourceGroupNameParameter", + Azure.ResourceManager.CommonTypes.Versions.v5 +); +@@resourceParameterBaseFor(ResourceGroupNameParameter.resourceGroupName, + [ResourceHome.ResourceGroup] +); + +/** ManagementGroupNameParameter */ +@@armCommonParameter(ManagementGroupNameParameter.managementGroupName, + "ManagementGroupNameParameter", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonParameter(ManagementGroupNameParameter.managementGroupName, + "ManagementGroupNameParameter", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonParameter(ManagementGroupNameParameter.managementGroupName, + "ManagementGroupNameParameter", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + +/** ScopeParameter */ +@@armCommonParameter(ScopeParameter.scope, + "ScopeParameter", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonParameter(ScopeParameter.scope, + "ScopeParameter", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonParameter(ScopeParameter.scope, + "ScopeParameter", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + +/** LocationResourceParameter */ +@@armCommonParameter(LocationResourceParameter.location, + "LocationParameter", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonParameter(LocationResourceParameter.location, + "LocationParameter", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonParameter(LocationResourceParameter.location, + "LocationParameter", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + +/** + * The default operationId parameter type. + */ +@@armCommonParameter(OperationIdParameter.operationId, + "OperationIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonParameter(OperationIdParameter.operationId, + "OperationIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonParameter(OperationIdParameter.operationId, + "OperationIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + +/** + * TenantIdParameter + */ +@@armCommonParameter(TenantIdParameter.tenantId, + "TenantIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonParameter(TenantIdParameter.tenantId, + "TenantIdParameter", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonParameter(TenantIdParameter.tenantId, + "TenantIdParameter", Azure.ResourceManager.CommonTypes.Versions.v5 ); diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 7119ac8a10..6a5ead22d7 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -54,12 +54,6 @@ model TrackedResource extends Resource { */ model ProxyResource extends Resource {} -/** - * The base extension resource. - */ -// Note that ProxyResource is the base definition for both kinds of resources -model ExtensionResource extends Resource {} - /** * The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. */ @@ -430,7 +424,7 @@ union EncryptionStatus { /** * Configuration of key for data encryption */ -model encryptionProperties { +model EncryptionProperties { /** Indicates whether or not the encryption is enabled for container registry. */ status?: EncryptionStatus; @@ -441,7 +435,7 @@ model encryptionProperties { /** * Metadata pertaining to the geographic location of the resource. */ -model locationData { +model LocationData { /** A canonical name for the geographic or physical location. */ @maxLength(256) name: string; @@ -513,6 +507,16 @@ model SubscriptionIdParameter { subscriptionId: uuid; } +@doc("The default location parameter type.") +model LocationResourceParameter { + @path + @minLength(1) + @segment("locations") + @doc("The location name.") + @key + location: string; +} + /** * The default ManagementGroupName parameter type. */ diff --git a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp index e8b0595352..6f781f0417 100644 --- a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Foundations { alias AzureEntityResource = CommonTypes.AzureEntityResource; alias TrackedResource = CommonTypes.TrackedResource; alias ProxyResource = CommonTypes.ProxyResource; - alias ExtensionResource = CommonTypes.ExtensionResource; + alias ExtensionResource = CommonTypes.ProxyResource; alias Sku = CommonTypes.Sku; alias SkuTier = CommonTypes.SkuTier; alias OperationListResult = CommonTypes.OperationListResult; diff --git a/packages/typespec-azure-resource-manager/lib/parameters.tsp b/packages/typespec-azure-resource-manager/lib/parameters.tsp index 5d614fb073..43a17c652e 100644 --- a/packages/typespec-azure-resource-manager/lib/parameters.tsp +++ b/packages/typespec-azure-resource-manager/lib/parameters.tsp @@ -19,35 +19,29 @@ alias ApiVersionParameter = CommonTypes.ApiVersionParameter; alias SubscriptionIdParameter = CommonTypes.SubscriptionIdParameter; /** - * DEPRECATED - DO NOT USE - * The default location parameter type. + * The default ResourceGroup parameter type. */ -@doc("The default location parameter type.") -model LocationParameter { - @path - @minLength(1) - @segment("locations") - @doc("The location name.") - @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v3) - @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v4) - @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v5) - @resourceParameterBaseFor([ResourceHome.Location]) - location: string; -} +alias ResourceGroupParameter = CommonTypes.ResourceGroupNameParameter; + +/** + * The default LocationResource parameter type. + */ +alias LocationResourceParameter = CommonTypes.LocationResourceParameter; /** + * DEPRECATED - DO NOT USE * The default location parameter type. */ @doc("The default location parameter type.") -model LocationResourceParameter { +model LocationParameter { @path @minLength(1) @segment("locations") @doc("The location name.") - @key @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v3) @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v4) @armCommonParameter("LocationParameter", Azure.ResourceManager.CommonTypes.Versions.v5) + @resourceParameterBaseFor([ResourceHome.Location]) location: string; } @@ -84,24 +78,6 @@ model ArmLocationResource Date: Fri, 7 Jun 2024 16:06:10 -0700 Subject: [PATCH 18/25] fixing System data definition is different from swagger #679 --- docs/libraries/azure-resource-manager/reference/data-types.md | 4 ++-- .../lib/common-types/types.tsp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index a73dc5876d..e3fe3c8096 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -1635,10 +1635,10 @@ model Azure.ResourceManager.CommonTypes.SystemData | ------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------- | | createdBy? | `string` | The identity that created the resource. | | createdByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.CommonTypes.createdByType) | The type of identity that created the resource. | -| createdAt? | `plainDate` | The timestamp of resource creation (UTC). | +| createdAt? | `utcDateTime` | The timestamp of resource creation (UTC). | | lastModifiedBy? | `string` | The identity that last modified the resource. | | lastModifiedByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.CommonTypes.createdByType) | The type of identity that last modified the resource. | -| lastModifiedAt? | `plainDate` | The timestamp of resource last modification (UTC) | +| lastModifiedAt? | `utcDateTime` | The timestamp of resource last modification (UTC) | ### `TenantIdParameter` {#Azure.ResourceManager.CommonTypes.TenantIdParameter} diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 6a5ead22d7..bd4875122e 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -296,7 +296,7 @@ model SystemData { /** The timestamp of resource creation (UTC). */ @visibility("read") - createdAt?: plainDate; + createdAt?: utcDateTime; /** The identity that last modified the resource. */ @visibility("read") @@ -308,7 +308,7 @@ model SystemData { /** The timestamp of resource last modification (UTC) */ @visibility("read") - lastModifiedAt?: plainDate; + lastModifiedAt?: utcDateTime; } /** From 3e40bdff9c824ca71fe9ab3e4a3c6a4ea661d68e Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 7 Jun 2024 17:58:16 -0700 Subject: [PATCH 19/25] Restore extension resource to CommonTypes --- .../reference/data-types.md | 12 ++++++++++++ .../azure-resource-manager/reference/index.mdx | 1 + .../lib/common-types/types-ref.tsp | 16 ++++++++++++++++ .../lib/common-types/types.tsp | 6 ++++++ .../lib/foundations/backcompat.tsp | 2 +- 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index e3fe3c8096..3f5457a77b 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -1085,6 +1085,18 @@ model Azure.ResourceManager.CommonTypes.ExtendedLocation | name | `string` | The name of the extended location. | | type | [`ExtendedLocationType`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtendedLocationType) | The type of the extended location. | +### `ExtensionResource` {#Azure.ResourceManager.CommonTypes.ExtensionResource} + +The base extension resource. + +```typespec +model Azure.ResourceManager.CommonTypes.ExtensionResource +``` + +#### Properties + +None + ### `Identity` {#Azure.ResourceManager.CommonTypes.Identity} Identity for the resource. diff --git a/docs/libraries/azure-resource-manager/reference/index.mdx b/docs/libraries/azure-resource-manager/reference/index.mdx index b865165719..ef473192d6 100644 --- a/docs/libraries/azure-resource-manager/reference/index.mdx +++ b/docs/libraries/azure-resource-manager/reference/index.mdx @@ -175,6 +175,7 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ErrorDetail`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorDetail) - [`ErrorResponse`](./data-types.md#Azure.ResourceManager.CommonTypes.ErrorResponse) - [`ExtendedLocation`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtendedLocation) +- [`ExtensionResource`](./data-types.md#Azure.ResourceManager.CommonTypes.ExtensionResource) - [`Identity`](./data-types.md#Azure.ResourceManager.CommonTypes.Identity) - [`IfMatchHeader`](./data-types.md#Azure.ResourceManager.CommonTypes.IfMatchHeader) - [`IfNoneMatchHeader`](./data-types.md#Azure.ResourceManager.CommonTypes.IfNoneMatchHeader) diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp index bf88692219..09cadfb7ba 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types-ref.tsp @@ -58,6 +58,22 @@ namespace Azure.ResourceManager.CommonTypes; Azure.ResourceManager.CommonTypes.Versions.v5 ); +/** + * The base extension resource. + */ +@@armCommonDefinition(ExtensionResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v3 +); +@@armCommonDefinition(ExtensionResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v4 +); +@@armCommonDefinition(ExtensionResource, + "ProxyResource", + Azure.ResourceManager.CommonTypes.Versions.v5 +); + /** * The SKU (Stock Keeping Unit) assigned to this resource. */ diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index bd4875122e..9bf7c9b3ee 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -54,6 +54,12 @@ model TrackedResource extends Resource { */ model ProxyResource extends Resource {} +/** + * The base extension resource. + */ +// Note that ProxyResource is the base definition for both kinds of resources +model ExtensionResource extends Resource {} + /** * The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. */ diff --git a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp index 6f781f0417..e8b0595352 100644 --- a/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp +++ b/packages/typespec-azure-resource-manager/lib/foundations/backcompat.tsp @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Foundations { alias AzureEntityResource = CommonTypes.AzureEntityResource; alias TrackedResource = CommonTypes.TrackedResource; alias ProxyResource = CommonTypes.ProxyResource; - alias ExtensionResource = CommonTypes.ProxyResource; + alias ExtensionResource = CommonTypes.ExtensionResource; alias Sku = CommonTypes.Sku; alias SkuTier = CommonTypes.SkuTier; alias OperationListResult = CommonTypes.OperationListResult; From e67e4efac9a8f28143e0636b82c09fdda505bd59 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 7 Jun 2024 22:01:55 -0700 Subject: [PATCH 20/25] Fixing managed-identity version reference --- .../lib/common-types/managed-identity-ref.tsp | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp index c32751ba18..c839d489ed 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/managed-identity-ref.tsp @@ -9,7 +9,12 @@ namespace Azure.ResourceManager.CommonTypes; */ @@armCommonDefinition(ManagedServiceIdentity, "ManagedServiceIdentity", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "managedidentity.json" +); +@@armCommonDefinition(ManagedServiceIdentity, + "ManagedServiceIdentity", + Azure.ResourceManager.CommonTypes.Versions.v4, "managedidentity.json" ); @@armCommonDefinition(ManagedServiceIdentity, @@ -21,7 +26,12 @@ namespace Azure.ResourceManager.CommonTypes; /** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", */ @@armCommonDefinition(UserAssignedIdentities, "UserAssignedIdentities", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "managedidentity.json" +); +@@armCommonDefinition(UserAssignedIdentities, + "UserAssignedIdentities", + Azure.ResourceManager.CommonTypes.Versions.v4, "managedidentity.json" ); @@armCommonDefinition(UserAssignedIdentities, @@ -35,7 +45,12 @@ namespace Azure.ResourceManager.CommonTypes; */ @@armCommonDefinition(SystemAssignedServiceIdentity, "SystemAssignedServiceIdentity", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "managedidentity.json" +); +@@armCommonDefinition(SystemAssignedServiceIdentity, + "SystemAssignedServiceIdentity", + Azure.ResourceManager.CommonTypes.Versions.v4, "managedidentity.json" ); @@armCommonDefinition(SystemAssignedServiceIdentity, @@ -49,7 +64,12 @@ namespace Azure.ResourceManager.CommonTypes; */ @@armCommonDefinition(UserAssignedIdentity, "UserAssignedIdentity", - #{ version: Azure.ResourceManager.CommonTypes.Versions.v4, isDefault: true }, + #{ version: Azure.ResourceManager.CommonTypes.Versions.v3, isDefault: true }, + "managedidentity.json" +); +@@armCommonDefinition(UserAssignedIdentity, + "UserAssignedIdentity", + Azure.ResourceManager.CommonTypes.Versions.v4, "managedidentity.json" ); @@armCommonDefinition(UserAssignedIdentity, From 9cb0e96fd9c97872539621d7d7e747d5b585a9e4 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 11 Jun 2024 11:02:19 -0700 Subject: [PATCH 21/25] Fixing systemData readonly and description discrepency --- .../lib/common-types/types.tsp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 9bf7c9b3ee..5977c295b1 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -293,27 +293,21 @@ model ErrorAdditionalInfo { */ model SystemData { /** The identity that created the resource. */ - @visibility("read") createdBy?: string; /** The type of identity that created the resource. */ - @visibility("read") createdByType?: createdByType; /** The timestamp of resource creation (UTC). */ - @visibility("read") createdAt?: utcDateTime; /** The identity that last modified the resource. */ - @visibility("read") lastModifiedBy?: string; /** The type of identity that last modified the resource. */ - @visibility("read") lastModifiedByType?: createdByType; /** The timestamp of resource last modification (UTC) */ - @visibility("read") lastModifiedAt?: utcDateTime; } @@ -509,7 +503,7 @@ model SubscriptionIdParameter { @typeChangedFrom(Versions.v4, string) @path @segment("subscriptions") - @doc("The ID of the target subscription. The value must be an UUID.") + @doc("The ID of the target subscription. The value must be an UUID.") subscriptionId: uuid; } From 675590147174c41622717edc25b0a2039f82e893 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 11 Jun 2024 16:49:07 -0700 Subject: [PATCH 22/25] Fixed PR comments --- .../reference/data-types.md | 2 + .../common-properties/main.tsp | 16 +++-- .../encryption/main.tsp | 14 +++-- .../managed-identity/main.tsp | 14 +++-- .../{ => 2023-03-01-preview}/openapi.json | 62 ++++++++++--------- .../{ => 2023-03-01-preview}/openapi.json | 56 ++++++++--------- .../{ => 2023-03-01-preview}/openapi.json | 60 +++++++++--------- .../lib/common-types/types.tsp | 5 ++ .../src/lib.ts | 2 +- 9 files changed, 129 insertions(+), 102 deletions(-) rename packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/{ => 2023-03-01-preview}/openapi.json (79%) rename packages/samples/test/output/azure/resource-manager/resource-common-properties/encryption/@azure-tools/typespec-autorest/{ => 2023-03-01-preview}/openapi.json (76%) rename packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/{ => 2023-03-01-preview}/openapi.json (75%) diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index c15e476bbf..ec94a5e4ed 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -1753,6 +1753,8 @@ union Azure.ResourceManager.CommonTypes.createdByType ### `EncryptionStatus` {#Azure.ResourceManager.CommonTypes.EncryptionStatus} +Indicates whether or not the encryption is enabled for container registry. + ```typespec union Azure.ResourceManager.CommonTypes.EncryptionStatus ``` diff --git a/packages/samples/specs/resource-manager/resource-common-properties/common-properties/main.tsp b/packages/samples/specs/resource-manager/resource-common-properties/common-properties/main.tsp index bc38bafecb..0b9bfdeb33 100644 --- a/packages/samples/specs/resource-manager/resource-common-properties/common-properties/main.tsp +++ b/packages/samples/specs/resource-manager/resource-common-properties/common-properties/main.tsp @@ -14,14 +14,18 @@ using Azure.Core; @service({ title: "Contoso.CommonEnvelopePropertiesExample", }) -@OpenAPI.info({ - version: "2023-03-01-preview", -}) +@versioned(Versions) @doc("An example of using some of common envelope and property bag properties in a resource type. Their names are all end with 'Property'.") -@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) -@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) namespace Microsoft.UpdateTests; +/** UpdateTests API versions */ +enum Versions { + /** 2023-03-01-preview version */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) + `2023-03-01-preview`, +} + interface Operations extends Azure.ResourceManager.Operations {} @doc("Widget Resource") @@ -56,7 +60,7 @@ model WidgetResourceProperties { @armResourceOperations interface Widgets { get is ArmResourceRead; - create is ArmResourceCreateOrUpdateAsync; + create is ArmResourceCreateOrReplaceAsync; update is ArmTagsPatchSync; delete is ArmResourceDeleteWithoutOkAsync; listByResourceGroup is ArmResourceListByParent; diff --git a/packages/samples/specs/resource-manager/resource-common-properties/encryption/main.tsp b/packages/samples/specs/resource-manager/resource-common-properties/encryption/main.tsp index 2dc3e955b1..812435d79b 100644 --- a/packages/samples/specs/resource-manager/resource-common-properties/encryption/main.tsp +++ b/packages/samples/specs/resource-manager/resource-common-properties/encryption/main.tsp @@ -14,14 +14,18 @@ using Azure.Core; @service({ title: "Contoso.CustomerManagedKeyExample", }) -@OpenAPI.info({ - version: "2023-03-01-preview", -}) +@versioned(Versions) @doc("An example of using the Customer Managed Key Encryption properties in a resource type.") -@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) -@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) namespace Microsoft.UpdateTests; +/** UpdateTests API versions */ +enum Versions { + /** 2023-03-01-preview version */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) + `2023-03-01-preview`, +} + interface Operations extends Azure.ResourceManager.Operations {} @doc("Widget Resource") diff --git a/packages/samples/specs/resource-manager/resource-common-properties/managed-identity/main.tsp b/packages/samples/specs/resource-manager/resource-common-properties/managed-identity/main.tsp index ce69a3fd33..33af6987c1 100644 --- a/packages/samples/specs/resource-manager/resource-common-properties/managed-identity/main.tsp +++ b/packages/samples/specs/resource-manager/resource-common-properties/managed-identity/main.tsp @@ -14,14 +14,18 @@ using Azure.Core; @service({ title: "Contoso.ManagedIdentityExample", }) -@OpenAPI.info({ - version: "2023-03-01-preview", -}) +@versioned(Versions) @doc("An example of using the ManagedIdentity properties in a resource type.") -@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) -@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) namespace Microsoft.UpdateTests; +/** UpdateTests API versions */ +enum Versions { + /** 2023-03-01-preview version */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) + `2023-03-01-preview`, +} + interface Operations extends Azure.ResourceManager.Operations {} @doc("Widget Resource") diff --git a/packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json similarity index 79% rename from packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/openapi.json rename to packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json index 09315c6220..55c9e6e16d 100644 --- a/packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/resource-common-properties/common-properties/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json @@ -56,20 +56,20 @@ "description": "List the operations for the provider", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" } }, "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -87,10 +87,10 @@ "description": "List WidgetResource resources by subscription ID", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { @@ -103,7 +103,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -121,13 +121,13 @@ "description": "List WidgetResource resources by resource group", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" } ], "responses": { @@ -140,7 +140,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -158,13 +158,13 @@ "description": "Get a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -185,7 +185,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } } @@ -198,13 +198,13 @@ "description": "Create a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -237,6 +237,10 @@ "$ref": "#/definitions/WidgetResource" }, "headers": { + "Azure-AsyncOperation": { + "type": "string", + "description": "A link to the status monitor" + }, "Retry-After": { "type": "integer", "format": "int32", @@ -247,7 +251,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -264,13 +268,13 @@ "description": "Update a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -300,7 +304,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } } @@ -313,13 +317,13 @@ "description": "Delete a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -351,7 +355,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -463,7 +467,7 @@ }, "allOf": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" } ] }, @@ -520,11 +524,11 @@ ] }, "plan": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/Plan", + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/Plan", "description": "Details of the resource plan." }, "sku": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/Sku", + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/Sku", "description": "The SKU (Stock Keeping Unit) assigned to this resource." } }, diff --git a/packages/samples/test/output/azure/resource-manager/resource-common-properties/encryption/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/resource-common-properties/encryption/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json similarity index 76% rename from packages/samples/test/output/azure/resource-manager/resource-common-properties/encryption/@azure-tools/typespec-autorest/openapi.json rename to packages/samples/test/output/azure/resource-manager/resource-common-properties/encryption/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json index 55d9acba80..49b6327cae 100644 --- a/packages/samples/test/output/azure/resource-manager/resource-common-properties/encryption/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/resource-common-properties/encryption/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json @@ -56,20 +56,20 @@ "description": "List the operations for the provider", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" } }, "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -87,10 +87,10 @@ "description": "List WidgetResource resources by subscription ID", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { @@ -103,7 +103,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -121,13 +121,13 @@ "description": "List WidgetResource resources by resource group", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" } ], "responses": { @@ -140,7 +140,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -158,13 +158,13 @@ "description": "Get a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -185,7 +185,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } } @@ -198,13 +198,13 @@ "description": "Create a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -251,7 +251,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -268,13 +268,13 @@ "description": "Update a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -304,7 +304,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } } @@ -317,13 +317,13 @@ "description": "Delete a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -355,7 +355,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -414,7 +414,7 @@ }, "allOf": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" } ] }, @@ -457,7 +457,7 @@ "readOnly": true }, "encryption": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/customermanagedkeys.json#/definitions/encryption", + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/customermanagedkeys.json#/definitions/encryption", "description": "All encryption configuration for a resource." } }, diff --git a/packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json similarity index 75% rename from packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/openapi.json rename to packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json index 8c944ba583..f90ff76fb9 100644 --- a/packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/resource-manager/resource-common-properties/managed-identity/@azure-tools/typespec-autorest/2023-03-01-preview/openapi.json @@ -56,20 +56,20 @@ "description": "List the operations for the provider", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" } }, "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -87,10 +87,10 @@ "description": "List WidgetResource resources by subscription ID", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { @@ -103,7 +103,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -121,13 +121,13 @@ "description": "List WidgetResource resources by resource group", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" } ], "responses": { @@ -140,7 +140,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -158,13 +158,13 @@ "description": "Get a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -185,7 +185,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } } @@ -198,13 +198,13 @@ "description": "Create a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -237,6 +237,10 @@ "$ref": "#/definitions/WidgetResource" }, "headers": { + "Azure-AsyncOperation": { + "type": "string", + "description": "A link to the status monitor" + }, "Retry-After": { "type": "integer", "format": "int32", @@ -247,7 +251,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -264,13 +268,13 @@ "description": "Update a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -300,7 +304,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } } @@ -313,13 +317,13 @@ "description": "Delete a WidgetResource", "parameters": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "name": "widgetName", @@ -351,7 +355,7 @@ "default": { "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" } } }, @@ -408,13 +412,13 @@ ] }, "identity": { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/managedidentity.json#/definitions/ManagedServiceIdentity", + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/managedidentity.json#/definitions/ManagedServiceIdentity", "description": "The managed service identities assigned to this resource." } }, "allOf": [ { - "$ref": "../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" } ] }, diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 5977c295b1..e65e7bfac9 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -416,9 +416,14 @@ union CheckNameAvailabilityReason { string, } +/** Indicates whether or not the encryption is enabled for container registry. */ union EncryptionStatus { + /** Encryption is enabled. */ enabled: "enabled", + + /** Encryption is disabled. */ disabled: "disabled", + string, } /** diff --git a/packages/typespec-azure-resource-manager/src/lib.ts b/packages/typespec-azure-resource-manager/src/lib.ts index 141c9aa66b..11dd6eca9c 100644 --- a/packages/typespec-azure-resource-manager/src/lib.ts +++ b/packages/typespec-azure-resource-manager/src/lib.ts @@ -79,7 +79,7 @@ export const $lib = createTypeSpecLibrary({ "arm-common-types-invalid-version": { severity: "error", messages: { - default: paramMessage`No ARM common-types version match the version string ${"versionString"}. The following versions are supported: ${"supportedVersions"}`, + default: paramMessage`No ARM common-types version matches the version string ${"versionString"}. The following versions are supported: ${"supportedVersions"}`, }, }, "decorator-in-namespace": { From 50b9992e1372a68dec11bf8d20b110cc9076d8c8 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 11 Jun 2024 17:58:08 -0700 Subject: [PATCH 23/25] Fixing merge issues --- .../azure-core/reference/interfaces.md | 4 +- .../reference/data-types.md | 377 +----------------- .../lib/common-types/types.tsp | 7 +- 3 files changed, 25 insertions(+), 363 deletions(-) diff --git a/docs/libraries/azure-core/reference/interfaces.md b/docs/libraries/azure-core/reference/interfaces.md index f3a8f10fb0..7ed271e946 100644 --- a/docs/libraries/azure-core/reference/interfaces.md +++ b/docs/libraries/azure-core/reference/interfaces.md @@ -263,7 +263,7 @@ op Azure.Core.ResourceOperations.LongRunningResourceCollectionAction(apiVersion: Resource operation status operation template. ```typespec -op Azure.Core.ResourceOperations.GetResourceOperationStatus(apiVersion: string): Azure.Core.ResourceOperationStatus | ErrorResponse +op Azure.Core.ResourceOperations.GetResourceOperationStatus(apiVersion: string, operationId: string): Azure.Core.ResourceOperationStatus | ErrorResponse ``` ##### Template Parameters @@ -280,7 +280,7 @@ op Azure.Core.ResourceOperations.GetResourceOperationStatus(apiVersion: string): Operation signature to retrieve a resource operation status. ```typespec -op Azure.Core.GetResourceOperationStatus(apiVersion: string): Azure.Core.ResourceOperationStatus | Azure.Core.Foundations.ErrorResponse +op Azure.Core.GetResourceOperationStatus(apiVersion: string, operationId: string): Azure.Core.ResourceOperationStatus | Azure.Core.Foundations.ErrorResponse ``` #### Template Parameters diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index 6a60a85b23..ab791e4c25 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -338,10 +338,10 @@ model Azure.ResourceManager.ArmResourceUpdatedResponse #### Properties -| Name | Type | Description | -| ---------- | ---------- | ---------------- | -| statusCode | `200` | The status code. | -| body | `Resource` | | +| Name | Type | Description | +| ---------- | ---------- | --------------------------------------------------- | +| statusCode | `200` | The status code. | +| body | `Resource` | The body type of the operation request or response. | ### `ArmResponse` {#Azure.ResourceManager.ArmResponse} @@ -723,10 +723,10 @@ model Azure.ResourceManager.ResourceListResult #### Properties -| Name | Type | Description | -| --------- | -------------------------------- | ----------- | -| value | `Array` | | -| nextLink? | `TypeSpec.Rest.ResourceLocation` | | +| Name | Type | Description | +| --------- | -------------------------------- | ---------------------------------- | +| value | `Array` | The {name} items on this page | +| nextLink? | `TypeSpec.Rest.ResourceLocation` | The link to the next page of items | ### `ResourceNameParameter` {#Azure.ResourceManager.ResourceNameParameter} @@ -1918,7 +1918,7 @@ model Azure.ResourceManager.Foundations.ExtensionScope | ----------- | -------------------------------- | ---------------------------------------------------------------------- | | apiVersion | `string` | The API version to use for this operation. | | resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | -| provider | `"Microsoft.ThisWillBeReplaced"` | | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `LocationBaseParameters` {#Azure.ResourceManager.Foundations.LocationBaseParameters} @@ -1952,144 +1952,12 @@ model Azure.ResourceManager.Foundations.LocationScope #### Properties -| Name | Type | Description | -| -------------- | -------------------------------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| location | `string` | The location name. | -| provider | `"Microsoft.ThisWillBeReplaced"` | | - -### `ManagedServiceIdentity` {#Azure.ResourceManager.Foundations.ManagedServiceIdentity} - -The properties of the managed service identities assigned to this resource. - -```typespec -model Azure.ResourceManager.Foundations.ManagedServiceIdentity -``` - -#### Properties - -| Name | Type | Description | -| ----------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------- | -| tenantId? | `string` | The Active Directory tenant id of the principal. | -| principalId? | `string` | The active directory identifier of this principal. | -| type | [`ManagedServiceIdentityType`](./data-types.md#Azure.ResourceManager.Foundations.ManagedServiceIdentityType) | The type of managed identity assigned to this resource. | -| userAssignedIdentities? | `Record` | The identities assigned to this resource by the user. | - -### `Operation` {#Azure.ResourceManager.Foundations.Operation} - -Details of a REST API operation, returned from the Resource Provider Operations API - -```typespec -model Azure.ResourceManager.Foundations.Operation -``` - -#### Properties - -| Name | Type | Description | -| ------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name? | `string` | The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" | -| isDataAction? | `boolean` | Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. | -| display? | [`OperationDisplay`](./data-types.md#Azure.ResourceManager.Foundations.OperationDisplay) | Localized display information for this particular operation. | -| origin? | [`Origin`](./data-types.md#Azure.ResourceManager.Foundations.Origin) | The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" | -| actionType? | [`ActionType`](./data-types.md#Azure.ResourceManager.Foundations.ActionType) | Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. | - -### `OperationDisplay` {#Azure.ResourceManager.Foundations.OperationDisplay} - -Localized display information for and operation. - -```typespec -model Azure.ResourceManager.Foundations.OperationDisplay -``` - -#### Properties - -| Name | Type | Description | -| ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| provider? | `string` | The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". | -| resource? | `string` | The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". | -| operation? | `string` | The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". | -| description? | `string` | The short, localized friendly description of the operation; suitable for tool tips and detailed views. | - -### `OperationIdParameter` {#Azure.ResourceManager.Foundations.OperationIdParameter} - -The default operationId parameter type. - -```typespec -model Azure.ResourceManager.Foundations.OperationIdParameter -``` - -#### Properties - -| Name | Type | Description | -| ----------- | -------- | ------------------------------------- | -| operationId | `string` | The ID of an ongoing async operation. | - -### `OperationListResult` {#Azure.ResourceManager.Foundations.OperationListResult} - -A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - -```typespec -model Azure.ResourceManager.Foundations.OperationListResult -``` - -#### Properties - -| Name | Type | Description | -| --------- | ----------------------------------------- | ---------------------------------- | -| value | `ResourceManager.Foundations.Operation[]` | The Operation items on this page | -| nextLink? | `TypeSpec.Rest.ResourceLocation` | The link to the next page of items | - -### `OperationStatusResult` {#Azure.ResourceManager.Foundations.OperationStatusResult} - -The current status of an async operation. - -```typespec -model Azure.ResourceManager.Foundations.OperationStatusResult -``` - -#### Properties - -| Name | Type | Description | -| ---------------- | ------------------------------------------------------------------------------ | ------------------------------------------- | -| id? | `string` | Fully qualified ID for the async operation. | -| name? | `string` | Name of the async operation. | -| status | `string` | Operation status. | -| percentComplete? | `float64` | Percent of the operation that is complete. | -| startTime? | `utcDateTime` | The start time of the operation. | -| endTime? | `utcDateTime` | The end time of the operation. | -| operations | `ResourceManager.Foundations.OperationStatusResult[]` | The operations list. | -| error? | [`ErrorDetail`](./data-types.md#Azure.ResourceManager.Foundations.ErrorDetail) | If present, details of the operation error. | - -### `Plan` {#Azure.ResourceManager.Foundations.Plan} - -Details of the resource plan. - -```typespec -model Azure.ResourceManager.Foundations.Plan -``` - -#### Properties - -| Name | Type | Description | -| -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | `string` | A user defined name of the 3rd Party Artifact that is being procured. | -| publisher | `string` | The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic | -| product | `string` | 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. | -| promotionCode? | `string` | A publisher provided promotion code as provisioned in Data Market for the said product/artifact. | -| version? | `string` | The version of the desired product/artifact. | - -### `ProxyResource` {#Azure.ResourceManager.Foundations.ProxyResource} - -The base proxy resource. - -```typespec -model Azure.ResourceManager.Foundations.ProxyResource -``` - -#### Properties - -None +| Name | Type | Description | +| -------------- | -------------------------------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| location | `string` | The location name. | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `ProxyResourceUpdateModel` {#Azure.ResourceManager.Foundations.ProxyResourceUpdateModel} @@ -2151,7 +2019,7 @@ model Azure.ResourceManager.Foundations.ResourceGroupScope | location | `string` | The location name. | | resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | | resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | -| provider | `"Microsoft.ThisWillBeReplaced"` | | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `ResourceUpdateModel` {#Azure.ResourceManager.Foundations.ResourceUpdateModel} @@ -2226,46 +2094,11 @@ model Azure.ResourceManager.Foundations.SubscriptionScope #### Properties -| Name | Type | Description | -| -------------- | -------------------------------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `string` | The ID of the target subscription. | -| provider | `"Microsoft.ThisWillBeReplaced"` | | - -### `SystemAssignedServiceIdentity` {#Azure.ResourceManager.Foundations.SystemAssignedServiceIdentity} - -The properties of the service-assigned identity associated with this resource. - -```typespec -model Azure.ResourceManager.Foundations.SystemAssignedServiceIdentity -``` - -#### Properties - -| Name | Type | Description | -| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | -| tenantId? | `string` | The Active Directory tenant id of the principal. | -| principalId? | `string` | The active directory identifier of this principal. | -| type | [`SystemAssignedServiceIdentityType`](./data-types.md#Azure.ResourceManager.Foundations.SystemAssignedServiceIdentityType) | The type of managed identity assigned to this resource. | - -### `SystemData` {#Azure.ResourceManager.Foundations.SystemData} - -Metadata pertaining to creation and last modification of the resource. - -```typespec -model Azure.ResourceManager.Foundations.SystemData -``` - -#### Properties - -| Name | Type | Description | -| ------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------- | -| createdBy? | `string` | The identity that created the resource. | -| createdByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.Foundations.createdByType) | The type of identity that created the resource. | -| createdAt? | `plainDate` | The type of identity that created the resource. | -| lastModifiedBy? | `string` | The identity that last modified the resource. | -| lastModifiedByType? | [`createdByType`](./data-types.md#Azure.ResourceManager.Foundations.createdByType) | The type of identity that last modified the resource. | -| lastModifiedAt? | `plainDate` | The timestamp of resource last modification (UTC) | +| Name | Type | Description | +| -------------- | -------------------------------- | ------------------------------------------------------------- | +| apiVersion | `string` | The API version to use for this operation. | +| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | ### `TagsUpdateModel` {#Azure.ResourceManager.Foundations.TagsUpdateModel} @@ -2320,170 +2153,4 @@ model Azure.ResourceManager.Foundations.TenantScope | Name | Type | Description | | ---------- | -------------------------------- | ------------------------------------------ | | apiVersion | `string` | The API version to use for this operation. | -| provider | `"Microsoft.ThisWillBeReplaced"` | | - -### `TrackedResource` {#Azure.ResourceManager.Foundations.TrackedResource} - -The base tracked resource. - -```typespec -model Azure.ResourceManager.Foundations.TrackedResource -``` - -#### Properties - -| Name | Type | Description | -| -------- | ---------------- | ----------------------------------------- | -| location | `string` | The geo-location where the resource lives | -| tags? | `Record` | Resource tags. | - -### `UserAssignedIdentities` {#Azure.ResourceManager.Foundations.UserAssignedIdentities} - -The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", - -```typespec -model Azure.ResourceManager.Foundations.UserAssignedIdentities -``` - -#### Properties - -| Name | Type | Description | -| ---- | ------------------------------------------------------------------------------------------------ | --------------------- | -| | [`UserAssignedIdentity`](./data-types.md#Azure.ResourceManager.Foundations.UserAssignedIdentity) | Additional properties | - -### `UserAssignedIdentity` {#Azure.ResourceManager.Foundations.UserAssignedIdentity} - -A managed identity assigned by the user. - -```typespec -model Azure.ResourceManager.Foundations.UserAssignedIdentity -``` - -#### Properties - -| Name | Type | Description | -| ------------ | -------- | ---------------------------------------------------------- | -| clientId? | `string` | The active directory client identifier for this principal. | -| principalId? | `string` | The active directory identifier for this principal. | - -### `ResourceHome` {#Azure.ResourceManager.Foundations.ResourceHome} - -An internal enum to indicate the resource support for various path types - -```typespec -enum Azure.ResourceManager.Foundations.ResourceHome -``` - -### `SkuTier` {#Azure.ResourceManager.Foundations.SkuTier} - -Available service tiers for the SKU. - -```typespec -enum Azure.ResourceManager.Foundations.SkuTier -``` - -### `ActionType` {#Azure.ResourceManager.Foundations.ActionType} - -Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - -```typespec -union Azure.ResourceManager.Foundations.ActionType -``` - -### `CheckNameAvailabilityReason` {#Azure.ResourceManager.Foundations.CheckNameAvailabilityReason} - -Possible reasons for a name not being available. - -```typespec -union Azure.ResourceManager.Foundations.CheckNameAvailabilityReason -``` - -#### Template Parameters - -| Name | Description | -| ---------- | --------------------------- | -| Resource | The type of the resource. | -| Properties | The type of the properties. | - -#### Properties - -None - -### `SubscriptionBaseParameters` {#Azure.ResourceManager.Foundations.SubscriptionBaseParameters} - -The kind of entity that created the resource. - -```typespec -union Azure.ResourceManager.Foundations.createdByType -``` - -#### Properties - -| Name | Type | Description | -| -------------- | ----------- | ------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | - -### `SubscriptionScope` {#Azure.ResourceManager.Foundations.SubscriptionScope} - -The supported ExtendedLocation types. - -```typespec -model Azure.ResourceManager.Foundations.SubscriptionScope -``` - -#### Template Parameters - -| Name | Description | -| -------- | ------------------------- | -| Resource | The type of the resource. | - -#### Properties - -| Name | Type | Description | -| -------------- | -------------------------------- | ------------------------------------------------------------- | -| apiVersion | `string` | The API version to use for this operation. | -| subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | - -### `TagsUpdateModel` {#Azure.ResourceManager.Foundations.TagsUpdateModel} - -The kind of managed identity assigned to this resource. - -```typespec -model Azure.ResourceManager.Foundations.TagsUpdateModel -``` - -#### Template Parameters - -| Name | Description | -| -------- | ------------------------- | -| Resource | The type of the resource. | - -#### Properties - -| Name | Type | Description | -| ----- | ---------------- | -------------- | -| tags? | `Record` | Resource tags. | - -### `TenantBaseParameters` {#Azure.ResourceManager.Foundations.TenantBaseParameters} - -The static parameters for a tenant-based resource - -```typespec -union Azure.ResourceManager.Foundations.Origin -``` - -#### Properties - -| Name | Type | Description | -| ---------- | -------- | ------------------------------------------ | -| apiVersion | `string` | The API version to use for this operation. | - -### `TenantScope` {#Azure.ResourceManager.Foundations.TenantScope} - -The kind of managemed identity assigned to this resource. - -```typespec -union Azure.ResourceManager.Foundations.SystemAssignedServiceIdentityType -``` +| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index a244593958..074429d901 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -125,12 +125,7 @@ union SkuTier { /** * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -@armCommonDefinition("OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v3) -@armCommonDefinition("OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v4) -@armCommonDefinition("OperationListResult", Azure.ResourceManager.CommonTypes.Versions.v5) -@doc(""" - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - """) +@friendlyName("OperationListResult") model OperationListResult is Azure.Core.Page; /** From 28a17166b95199f89de8dde61a3e8656000cbf8b Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 11 Jun 2024 18:34:44 -0700 Subject: [PATCH 24/25] Fixing merged errors. --- .../reference/data-types.md | 32 ++++++------- .../lib/common-types/types.tsp | 47 +++++++------------ 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index ab791e4c25..36b55a21fb 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -187,9 +187,9 @@ model Azure.ResourceManager.ArmLocationResource #### Properties -| Name | Type | Description | -| -------- | -------- | ------------------ | -| location | `string` | The location name. | +| Name | Type | Description | +| -------- | -------- | ----------------------------- | +| location | `string` | The name of the Azure region. | ### `ArmLroLocationHeader` {#Azure.ResourceManager.ArmLroLocationHeader} @@ -657,9 +657,9 @@ model Azure.ResourceManager.ResourceGroupLocationResource #### Properties -| Name | Type | Description | -| -------- | -------- | ------------------ | -| location | `string` | The location name. | +| Name | Type | Description | +| -------- | -------- | ----------------------------- | +| location | `string` | The name of the Azure region. | ### `ResourceInstanceParameters` {#Azure.ResourceManager.ResourceInstanceParameters} @@ -851,9 +851,9 @@ model Azure.ResourceManager.SubscriptionLocationResource #### Properties -| Name | Type | Description | -| -------- | -------- | ------------------ | -| location | `string` | The location name. | +| Name | Type | Description | +| -------- | -------- | ----------------------------- | +| location | `string` | The name of the Azure region. | ### `TenantLocationResource` {#Azure.ResourceManager.TenantLocationResource} @@ -866,9 +866,9 @@ model Azure.ResourceManager.TenantLocationResource #### Properties -| Name | Type | Description | -| -------- | -------- | ------------------ | -| location | `string` | The location name. | +| Name | Type | Description | +| -------- | -------- | ----------------------------- | +| location | `string` | The name of the Azure region. | ### `TrackedResource` {#Azure.ResourceManager.TrackedResource} @@ -1216,9 +1216,9 @@ model Azure.ResourceManager.CommonTypes.LocationResourceParameter #### Properties -| Name | Type | Description | -| -------- | -------- | ------------------ | -| location | `string` | The location name. | +| Name | Type | Description | +| -------- | -------- | ----------------------------- | +| location | `string` | The name of the Azure region. | ### `ManagedServiceIdentity` {#Azure.ResourceManager.CommonTypes.ManagedServiceIdentity} @@ -1527,7 +1527,7 @@ None ### `Resource` {#Azure.ResourceManager.CommonTypes.Resource} -Base model that defines common properties for all Azure Resource Manager resources. +Common fields that are returned in the response for all Azure Resource Manager resources ```typespec model Azure.ResourceManager.CommonTypes.Resource diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 074429d901..b2d5c8b19a 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -6,10 +6,7 @@ using Azure.Core; namespace Azure.ResourceManager.CommonTypes; -/** - * Base model that defines common properties for all Azure Resource Manager resources. - */ -@doc("Common fields that are returned in the response for all Azure Resource Manager resources") +/** Common fields that are returned in the response for all Azure Resource Manager resources */ @extension("x-ms-azure-resource", true) model Resource { /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ @@ -132,30 +129,30 @@ model OperationListResult is Azure.Core.Page; * Details of a REST API operation, returned from the Resource Provider Operations API */ model Operation { - @doc(""" + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - """) + */ @visibility("read") name?: string; - @doc(""" + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. - """) + */ @visibility("read") isDataAction?: boolean; /** Localized display information for this particular operation. */ display?: OperationDisplay; - @doc(""" + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - """) + */ @visibility("read") origin?: Origin; - @doc(""" + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """) + */ actionType?: ActionType; } @@ -168,14 +165,14 @@ model OperationDisplay { */ provider?: string; - @doc(""" + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - """) + */ resource?: string; - @doc(""" + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - """) + */ operation?: string; /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ @@ -216,9 +213,6 @@ model OperationStatusResult { /** * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ -@doc(""" - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """) union ActionType { /** Actions are for internal-only APIs. */ Internal: "Internal", @@ -229,9 +223,6 @@ union ActionType { /** * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ -@doc(""" - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - """) union Origin { /** Indicates the operation is initiated by a user. */ user: "user", @@ -276,7 +267,7 @@ model ErrorDetail { */ @error model ErrorResponse { - @doc("The error object.") + /** The error object. */ error?: ErrorDetail; } @@ -463,11 +454,10 @@ model LocationData { /** * The default api-version parameter type. */ -@doc("The default api-version parameter type.") model ApiVersionParameter { + /** The API version to use for this operation. */ @query("api-version") @minLength(1) - @doc("The API version to use for this operation.") apiVersion: string; } @@ -508,21 +498,20 @@ model ResourceGroupNameParameter { /** * The default subscriptionId parameter type. */ -@doc("The default subscriptionId parameter type.") model SubscriptionIdParameter { + /** The ID of the target subscription. The value must be an UUID. */ @typeChangedFrom(Versions.v4, string) @path @segment("subscriptions") - @doc("The ID of the target subscription. The value must be an UUID.") subscriptionId: uuid; } -@doc("The default location parameter type.") +/** The default location parameter type. */ model LocationResourceParameter { + /** The name of the Azure region. */ @path @minLength(1) @segment("locations") - @doc("The location name.") @key location: string; } From 2d69e58d9487901b78d32889ae25e5c9f15b0707 Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Tue, 11 Jun 2024 19:17:53 -0700 Subject: [PATCH 25/25] Fix PR break --- .../azure-core/reference/data-types.md | 12 ++++----- .../azure-core/reference/interfaces.md | 4 +-- .../reference/data-types.md | 26 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/libraries/azure-core/reference/data-types.md b/docs/libraries/azure-core/reference/data-types.md index 91cc9c87b1..e01fc47e41 100644 --- a/docs/libraries/azure-core/reference/data-types.md +++ b/docs/libraries/azure-core/reference/data-types.md @@ -348,12 +348,12 @@ model Azure.Core.ResourceOperationStatus #### Properties -| Name | Type | Description | -| ------- | ------------------------------------------------------------------------- | -------------------------------------------------------------- | -| id | `string` | The unique ID of the operation. | -| status | [`OperationState`](./data-types.md#Azure.Core.Foundations.OperationState) | The status of the operation | -| error? | `StatusError` | Error object that describes the error when status is "Failed". | -| result? | `StatusResult` | The result of the operation. | +| Name | Type | Description | +| ------- | ------------------------------------------------------------------------- | ----------- | +| id | `string` | | +| status | [`OperationState`](./data-types.md#Azure.Core.Foundations.OperationState) | | +| error? | `StatusError` | | +| result? | `StatusResult` | | ### `ResponseProperty` {#Azure.Core.ResponseProperty} diff --git a/docs/libraries/azure-core/reference/interfaces.md b/docs/libraries/azure-core/reference/interfaces.md index 7ed271e946..f3a8f10fb0 100644 --- a/docs/libraries/azure-core/reference/interfaces.md +++ b/docs/libraries/azure-core/reference/interfaces.md @@ -263,7 +263,7 @@ op Azure.Core.ResourceOperations.LongRunningResourceCollectionAction(apiVersion: Resource operation status operation template. ```typespec -op Azure.Core.ResourceOperations.GetResourceOperationStatus(apiVersion: string, operationId: string): Azure.Core.ResourceOperationStatus | ErrorResponse +op Azure.Core.ResourceOperations.GetResourceOperationStatus(apiVersion: string): Azure.Core.ResourceOperationStatus | ErrorResponse ``` ##### Template Parameters @@ -280,7 +280,7 @@ op Azure.Core.ResourceOperations.GetResourceOperationStatus(apiVersion: string, Operation signature to retrieve a resource operation status. ```typespec -op Azure.Core.GetResourceOperationStatus(apiVersion: string, operationId: string): Azure.Core.ResourceOperationStatus | Azure.Core.Foundations.ErrorResponse +op Azure.Core.GetResourceOperationStatus(apiVersion: string): Azure.Core.ResourceOperationStatus | Azure.Core.Foundations.ErrorResponse ``` #### Template Parameters diff --git a/docs/libraries/azure-resource-manager/reference/data-types.md b/docs/libraries/azure-resource-manager/reference/data-types.md index 36b55a21fb..178430fad5 100644 --- a/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/docs/libraries/azure-resource-manager/reference/data-types.md @@ -338,10 +338,10 @@ model Azure.ResourceManager.ArmResourceUpdatedResponse #### Properties -| Name | Type | Description | -| ---------- | ---------- | --------------------------------------------------- | -| statusCode | `200` | The status code. | -| body | `Resource` | The body type of the operation request or response. | +| Name | Type | Description | +| ---------- | ---------- | ---------------- | +| statusCode | `200` | The status code. | +| body | `Resource` | | ### `ArmResponse` {#Azure.ResourceManager.ArmResponse} @@ -723,10 +723,10 @@ model Azure.ResourceManager.ResourceListResult #### Properties -| Name | Type | Description | -| --------- | -------------------------------- | ---------------------------------- | -| value | `Array` | The {name} items on this page | -| nextLink? | `TypeSpec.Rest.ResourceLocation` | The link to the next page of items | +| Name | Type | Description | +| --------- | -------------------------------- | ----------- | +| value | `Array` | | +| nextLink? | `TypeSpec.Rest.ResourceLocation` | | ### `ResourceNameParameter` {#Azure.ResourceManager.ResourceNameParameter} @@ -1918,7 +1918,7 @@ model Azure.ResourceManager.Foundations.ExtensionScope | ----------- | -------------------------------- | ---------------------------------------------------------------------- | | apiVersion | `string` | The API version to use for this operation. | | resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| provider | `"Microsoft.ThisWillBeReplaced"` | | ### `LocationBaseParameters` {#Azure.ResourceManager.Foundations.LocationBaseParameters} @@ -1957,7 +1957,7 @@ model Azure.ResourceManager.Foundations.LocationScope | apiVersion | `string` | The API version to use for this operation. | | subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | | location | `string` | The location name. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| provider | `"Microsoft.ThisWillBeReplaced"` | | ### `ProxyResourceUpdateModel` {#Azure.ResourceManager.Foundations.ProxyResourceUpdateModel} @@ -2019,7 +2019,7 @@ model Azure.ResourceManager.Foundations.ResourceGroupScope | location | `string` | The location name. | | resourceGroupName | `string` | The name of the resource group. The name is case insensitive. | | resourceUri | `string` | The fully qualified Azure Resource manager identifier of the resource. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| provider | `"Microsoft.ThisWillBeReplaced"` | | ### `ResourceUpdateModel` {#Azure.ResourceManager.Foundations.ResourceUpdateModel} @@ -2098,7 +2098,7 @@ model Azure.ResourceManager.Foundations.SubscriptionScope | -------------- | -------------------------------- | ------------------------------------------------------------- | | apiVersion | `string` | The API version to use for this operation. | | subscriptionId | `Core.uuid` | The ID of the target subscription. The value must be an UUID. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| provider | `"Microsoft.ThisWillBeReplaced"` | | ### `TagsUpdateModel` {#Azure.ResourceManager.Foundations.TagsUpdateModel} @@ -2153,4 +2153,4 @@ model Azure.ResourceManager.Foundations.TenantScope | Name | Type | Description | | ---------- | -------------------------------- | ------------------------------------------ | | apiVersion | `string` | The API version to use for this operation. | -| provider | `"Microsoft.ThisWillBeReplaced"` | The provider namespace for the resource. | +| provider | `"Microsoft.ThisWillBeReplaced"` | |