diff --git a/specification/ai/Azure.AI.Unified/common/models.tsp b/specification/ai/Azure.AI.Unified/common/models.tsp index d63ca4a87faa..48b358f42f70 100644 --- a/specification/ai/Azure.AI.Unified/common/models.tsp +++ b/specification/ai/Azure.AI.Unified/common/models.tsp @@ -223,46 +223,12 @@ model OutputPathAssetReference extends AssetReferenceBase { #suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" @doc("Base definition for an asset.") -model AssetBase extends ResourceBase { - @doc("If the name version are system generated (anonymous registration).") - @visibility("read", "create") - isAnonymous?: boolean; - - @doc("Is the asset archived?") +model AssetBase { + @doc("Asset stage") @visibility("read", "create", "update") - isArchived?: boolean; -} - -@doc("Enum to determine the type of data.") -union DatasetType { - string, - - @doc("URI file.") - uri_file: "uri_file", - - @doc("URI folder.") - uri_folder: "uri_folder", -} + stage?: string; -#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" -@doc("AssetContainer definition") -model AssetContainer extends ResourceBase { - @doc("Is the asset archived?") - @visibility("read", "create", "update") - isArchived?: boolean; - - @doc("The latest version inside this container.") - @visibility("read") - latestVersion?: string; - - @doc("The next auto incremental version") - @visibility("read") - nextVersion?: string; -} - -@doc("ResourceBase definition") -model ResourceBase { - @doc("A unique identifier for the asset") + @doc("A unique identifier for the asset, assetId probably?") @visibility("read") id?: string; @@ -270,12 +236,13 @@ model ResourceBase { @visibility("read") name?: string; + @doc("The version of the resource") + @visibility("read") + version?: string; + @doc("The asset description text.") description?: string; - @doc("The asset property dictionary.") - properties?: Record; - @doc("Tag dictionary. Tags can be added, removed, and updated.") tags?: Record; @@ -284,6 +251,27 @@ model ResourceBase { systemData?: SystemData; } +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" +@doc("AssetContainer definition") +model AssetContainer { + @doc("The next auto incremental version") + @visibility("read") + nextVersion?: string; + + @doc("Key is label name, value is version.") + @visibility("read, update") + labels: Record; + + @doc("A unique identifier for the asset, assetId probably?") + @visibility("read") + id?: string; + + @doc("The name of the resource") + @visibility("read") + name?: string; +} + + #suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create reponses correctly" alias ResourceCreatedResponse = TypeSpec.Http.Response<201> & T; @@ -316,8 +304,59 @@ alias OkResponse = TypeSpec.Http.Response<2 pass_through: "pass-through", } + // Pending upload spec + // Define a URI alias for clarity. + alias Uri = string; + enum PendingUploadType { + None, + TemporaryBlobReference, + } + + enum PendingUploadCredentialType { + SAS, + } + + model PendingUploadRequestDto { + /// If PendingUploadId is not provided, a random guid will be used. + pendingUploadId?: string; + /// TemporaryBlobReference is the only supported type. + pendingUploadType: PendingUploadType = PendingUploadType.TemporaryBlobReference; + } + + model PendingUploadResponseDto { + /// Container-level read, write, list SAS. + blobReferenceForConsumption: BlobReferenceForConsumptionDto; + /// ID for this upload request. + pendingUploadId: string; + /// TemporaryBlobReference is the only supported type. + pendingUploadType: PendingUploadType = PendingUploadType.TemporaryBlobReference; + } + + /// Use a discriminated union to represent the abstract credential DTO. + /// The “credentialType” property acts as the discriminator. + @discriminator("credentialType") + union PendingUploadCredentialDto = SASCredentialDto; + + model SASCredentialDto { + /// The credential type is always SAS. + credentialType: PendingUploadCredentialType = PendingUploadCredentialType.SAS; + /// Full SAS Uri, including the storage, container/blob path and SAS token. + /// (SwaggerSecret attribute from C# can be noted here as a comment or using a custom decorator if needed.) + sasUri: Uri; + } + + model BlobReferenceForConsumptionDto { + /// Blob URI path for client to upload data. + /// Example: https://blob.windows.core.net/Container/Path + blobUri: Uri; + /// ARM ID of the storage account to use. + storageAccountArmId: string; + /// Credential info to access the storage account. + credential: PendingUploadCredentialDto; + } + @doc(""" The definition of a caller-specified function that chat completions may invoke in response to matching user input. """) diff --git a/specification/ai/Azure.AI.Unified/datasets/models.tsp b/specification/ai/Azure.AI.Unified/datasets/models.tsp index 5b05c0e7d30e..2e6c257597f8 100644 --- a/specification/ai/Azure.AI.Unified/datasets/models.tsp +++ b/specification/ai/Azure.AI.Unified/datasets/models.tsp @@ -22,19 +22,18 @@ model DatasetContainer extends AssetContainer { } -@doc("PagedDataContainer Definition") -@pagedResult -model PagedDatasetContainer { - @doc("The list of DatasetContainers.") - @extension("x-ms-identifiers", []) - @items - value: DatasetContainer[]; +@doc("Enum to determine the type of data.") +union DatasetType { + string, - @doc("The link to the next page of results, if any.") - @nextLink - nextLink?: string; + @doc("URI file.") + uri_file: "uri_file", + + @doc("URI folder.") + uri_folder: "uri_folder", } + #suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" @doc("DatasetVersion Definition") @discriminator("datasetType") diff --git a/specification/ai/Azure.AI.Unified/datasets/routes.tsp b/specification/ai/Azure.AI.Unified/datasets/routes.tsp index f12360f5338b..9db74d082f24 100644 --- a/specification/ai/Azure.AI.Unified/datasets/routes.tsp +++ b/specification/ai/Azure.AI.Unified/datasets/routes.tsp @@ -20,31 +20,15 @@ interface Datasets { @doc("List datasets in a project.") @route("/datasets") @get - listDatasets( - @doc("Continuation token for pagination.") - @query("$skip") - $skip?: string, + listLatestDatasets( + @doc("Continuation token for pagination. This is the nextLink from the previous response.") + @query("$continuationToken") + $continuationToken?: string, @doc("View type for including/excluding (for example) archived entities.") @query("listViewType") listViewType?: ListViewType, - ): PagedDatasetContainer; - - #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" - @doc("Delete container.") - @route("/datasets/{name}") - @delete - delete( - @doc("Name of Azure Machine Learning workspace.") - @pattern("^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$") - @path - workspaceName: string, - - @doc("Container name.") - @path - name: string, - ): void; + ): PagedDatasetVersion; #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" #suppress "@azure-tools/typespec-azure-core/use-standard-operations" @@ -129,4 +113,24 @@ interface Datasets { @body body: DatasetVersion, ): DatasetVersion; + + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" + @doc("Start pending upload.") + @post + @route("/datasets/{name}/versions/{version}/startPendingUpload") + createOrGetStartPendingUpload( + @doc("Container name.") + @pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$") + @path + name: string, + + @doc("Version identifier.") + @path + version: string, + + @doc("Pensing upload request.") + @body + body: PendingUploadRequestDto + ): PendingUploadResponseDto; }