diff --git a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/Archive.tsp b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/Archive.tsp index 78d12c56415f..56c71efc9062 100644 --- a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/Archive.tsp +++ b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/Archive.tsp @@ -9,29 +9,16 @@ using TypeSpec.Rest; using Azure.ResourceManager; using TypeSpec.Http; using TypeSpec.Versioning; -using TypeSpec.OpenAPI; namespace Microsoft.ContainerRegistry; +// we must have this legacy operations right now because there is a virtual resource `Package` between `Achieve` and `Registry` +// but we did not decide about how to represent such scenarios with "virtual resources" therefore we leave this legacy operations here for now. #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" interface AchieveOperationOps extends Azure.ResourceManager.Legacy.LegacyOperations< { - ...ApiVersionParameter, - ...SubscriptionIdParameter, - ...ResourceGroupParameter, - ...Azure.ResourceManager.Legacy.Provider, - - /** - * The name of the container registry. - */ - @path - @segment("registries") - @pattern("^[a-zA-Z0-9]*$") - @minLength(5) - @maxLength(50) - @doc("The name of the container registry.") - registryName: string, + ...ResourceInstanceParameters, /** * The package type. @@ -58,40 +45,6 @@ interface AchieveOperationOps } > {} -#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" -interface AchieveOps - extends Azure.ResourceManager.Legacy.LegacyOperations< - { - ...ApiVersionParameter, - ...SubscriptionIdParameter, - ...ResourceGroupParameter, - ...Azure.ResourceManager.Legacy.Provider, - - /** - * The name of the container registry. - */ - @path - @segment("registries") - @pattern("^[a-zA-Z0-9]*$") - @minLength(5) - @maxLength(50) - @doc("The name of the container registry.") - registryName: string, - - /** - * The package type. - */ - @path - @minLength(3) - @maxLength(50) - @pattern("^[a-zA-Z]*$") - @segment("packages") - @doc("The package type.") - packageType: string, - }, - {} - > {} - /** * An object that represents a archive for a container registry. */ @@ -137,9 +90,10 @@ interface Archives { /** * Lists all archives for the specified container registry and package type. */ - @action("archives") - @list - list is AchieveOps.Read>; + list is AchieveOperationOps.List< + Archive, + Response = ArmResponse + >; } @@maxLength(Archive.name, 200); diff --git a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/ArchiveVersion.tsp b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/ArchiveVersion.tsp index b1dcde68eadf..20953b7f9922 100644 --- a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/ArchiveVersion.tsp +++ b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/ArchiveVersion.tsp @@ -9,29 +9,15 @@ using TypeSpec.Rest; using Azure.ResourceManager; using TypeSpec.Http; using TypeSpec.Versioning; -using TypeSpec.OpenAPI; namespace Microsoft.ContainerRegistry; +// we must have this legacy operations right now because there is a virtual resource `Package` between `Achieve` and `Registry` #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" interface ArchiveVersionOperationOps extends Azure.ResourceManager.Legacy.LegacyOperations< { - ...ApiVersionParameter, - ...SubscriptionIdParameter, - ...ResourceGroupParameter, - ...Azure.ResourceManager.Legacy.Provider, - - /** - * The name of the container registry. - */ - @path - @segment("registries") - @pattern("^[a-zA-Z0-9]*$") - @minLength(5) - @maxLength(50) - @doc("The name of the container registry.") - registryName: string, + ...ResourceInstanceParameters, /** * The package type. @@ -69,50 +55,6 @@ interface ArchiveVersionOperationOps } > {} -#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" -interface ArchiveVersionListOps - extends Azure.ResourceManager.Legacy.LegacyOperations< - { - ...ApiVersionParameter, - ...SubscriptionIdParameter, - ...ResourceGroupParameter, - ...Azure.ResourceManager.Legacy.Provider, - - /** - * The name of the container registry. - */ - @path - @segment("registries") - @pattern("^[a-zA-Z0-9]*$") - @minLength(5) - @maxLength(50) - @doc("The name of the container registry.") - registryName: string, - - /** - * The package type. - */ - @path - @segment("packages") - @minLength(3) - @maxLength(50) - @pattern("^[a-zA-Z]*$") - @doc("The package type.") - packageType: string, - - /** - * The name of the archive resource. - */ - @path - @segment("archives") - @pattern("^[a-zA-Z0-9-]*$") - @minLength(5) - @maxLength(200) - @doc("The name of the archive resource.") - archiveName: string, - }, - {} - > {} /** * An object that represents an export pipeline for a container registry. */ @@ -152,9 +94,7 @@ interface ArchiveVersions { /** * Lists all archive versions for the specified container registry, repository type and archive name. */ - @action("versions") - @list - list is ArchiveVersionListOps.Read< + list is ArchiveVersionOperationOps.List< ArchiveVersion, Response = ArmResponse >; diff --git a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/main.tsp b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/main.tsp index 54435c68df8b..7e3f9dad34ad 100644 --- a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/main.tsp +++ b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/main.tsp @@ -52,9 +52,6 @@ import "./PipelineRun.tsp"; // Webhook feature import "./Webhook.tsp"; -using TypeSpec.Rest; -using TypeSpec.Http; -using Azure.ResourceManager.Foundations; using Azure.Core; using Azure.ResourceManager; using TypeSpec.Versioning; @@ -83,21 +80,5 @@ enum Versions { vLatestPreview: "2025-06-01-preview", } -interface Operations { - #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" - #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" - @tag("Operations") - @autoRoute - @Azure.ResourceManager.Private.armUpdateProviderNamespace - @doc("List the operations for the provider") - @segment("operations") - @list - list( - ...ApiVersionParameter, - - @path - @segment("providers") - @doc("The provider namespace (this parameter will not show up in operations).") - provider: "Microsoft.ThisWillBeReplaced", - ): ArmResponse | ErrorResponse; -} +interface Operations + extends Azure.ResourceManager.Legacy.Operations> {} diff --git a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/models.tsp b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/models.tsp index 3076e570737c..fa3d1cfd1e58 100644 --- a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/models.tsp +++ b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/models.tsp @@ -4,12 +4,7 @@ import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; import "@typespec/versioning"; -using TypeSpec.Rest; -using TypeSpec.Http; -using TypeSpec.Versioning; -using Azure.Core; using Azure.ResourceManager; -using Azure.ResourceManager.Foundations; namespace Microsoft.ContainerRegistry; /** @@ -83,72 +78,6 @@ enum ResourceIdentityType { None, } -/** - * The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - */ -model ProxyResource { - /** - * The resource ID. - */ - @visibility(Lifecycle.Read) - id?: string; - - /** - * The name of the resource. - */ - @visibility(Lifecycle.Read) - name?: string; - - /** - * The type of the resource. - */ - @visibility(Lifecycle.Read) - type?: string; - - /** - * Metadata pertaining to creation and last modification of the resource. - */ - @visibility(Lifecycle.Read) - systemData?: SystemData; -} - -/** - * Metadata pertaining to creation and last modification of the resource. - */ -model SystemData { - /** - * The identity that created the resource. - */ - createdBy?: string; - - /** - * The type of identity that created the resource. - */ - createdByType?: CreatedByType; - - /** - * The timestamp of resource creation (UTC). - */ - // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. - createdAt?: utcDateTime; - - /** - * The identity that last modified the resource. - */ - lastModifiedBy?: string; - - /** - * The type of identity that last modified the resource. - */ - lastModifiedByType?: LastModifiedByType; - - /** - * The timestamp of resource modification (UTC). - */ - // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. - lastModifiedAt?: utcDateTime; -} - /** * Managed identity for the resource. */ @@ -352,47 +281,6 @@ model OperationListResult { nextLink?: string; } -/** - * An Azure resource. - */ -model Resource { - /** - * The resource ID. - */ - @visibility(Lifecycle.Read) - id?: string; - - /** - * The name of the resource. - */ - @visibility(Lifecycle.Read) - name?: string; - - /** - * The type of the resource. - */ - @visibility(Lifecycle.Read) - type?: string; - - /** - * The location of the resource. This cannot be changed after the resource is created. - */ - @visibility(Lifecycle.Read, Lifecycle.Create) - location: string; - - /** - * The tags of the resource. - */ - #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" - tags?: Record; - - /** - * Metadata pertaining to creation and last modification of the resource. - */ - @visibility(Lifecycle.Read) - systemData?: SystemData; -} - /** * The Active Directory Object that will be used for authenticating the token of a container registry. */ diff --git a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/tspconfig.yaml b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/tspconfig.yaml index d3b0e9a211de..03c65585a19d 100644 --- a/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/tspconfig.yaml +++ b/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/tspconfig.yaml @@ -13,12 +13,10 @@ options: arm-types-dir: "{project-root}/../../../../common-types/resource-management" emit-lro-options: "all" - "@azure-tools/typespec-csharp": + "@azure-typespec/http-client-csharp-mgmt": emitter-output-dir: "{output-dir}/{service-dir}/{namespace}" - flavor: azure - clear-output-folder: true - model-namespace: true - namespace: "Azure.ResourceManager.ContainerRegistry" + package-name: "Azure.ResourceManager.ContainerRegistry" + namespace: "{package-name}" "@azure-tools/typespec-python": service-dir: "sdk/containerregistry" emitter-output-dir: "{output-dir}/{service-dir}/azure-mgmt-containerregistry"