Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions specification/ai/Azure.AI.Projects/common/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,12 @@ alias AssetBase = {

@doc("The name of the resource")
@visibility("read")
name?: string;
@key
name: string;

@doc("The version of the resource")
@visibility("read")
version?: string;
version: string;

@doc("The asset description text.")
description?: string;
Expand Down
14 changes: 1 addition & 13 deletions specification/ai/Azure.AI.Projects/datasets/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ union DatasetType {

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance"
@doc("DatasetVersion Definition")
@Rest.resource("datasets")
model DatasetVersion {
@doc("[Required] Uri of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330")
@visibility("read", "create")
Expand All @@ -38,16 +39,3 @@ model DatasetVersion {

...AssetBase;
}

@doc("PagedDataVersionBase Definition")
@pagedResult
model PagedDatasetVersion {
@doc("The list of DatasetVersions.")
@extension("x-ms-identifiers", [])
@items
value: DatasetVersion[];

@doc("The link to the next page of results, if any.")
@nextLink
nextLink?: string;
}
162 changes: 43 additions & 119 deletions specification/ai/Azure.AI.Projects/datasets/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "../common/models.tsp";
import "./models.tsp";
import "../servicepatterns.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
Expand All @@ -14,123 +15,46 @@ using Azure.Core.Foundations;

namespace Azure.AI.Projects;

interface Datasets {
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("List latest version of each dataset in a project.")
@route("/datasets")
@get
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,
): PagedDatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("List dataset versions of a specific dataset")
@route("/datasets/{name}/versions")
@get
listDatasetVersions(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Please choose OrderBy value from ['createdtime', 'modifiedtime']")
@query("$orderBy")
$orderBy?: string,

@doc("Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned")
@query("$top")
$top?: int32,

@doc("Continuation token for pagination.")
@query("$skip")
$skip?: string,

@doc("Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2")
@query("$tags")
$tags?: string,

@doc("[ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType,
): PagedDatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Delete version.")
@route("/datasets/{name}/versions/{version}")
@delete
deleteVersion(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,
): void;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Get dataset version.")
@route("/datasets/{name}/versions/{version}")
@get
getVersion(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,
): DatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Create or update version.")
@route("/datasets/{name}/versions/{version}")
@put
createOrUpdate(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,

@doc("Version entity to create or update.")
@body
datasetVersion: 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
pendingUploadRequest: PendingUploadRequest,
): PendingUploadResponse;
alias ListDatasetVersionsParameters = {
@doc("Please choose OrderBy value from ['createdtime', 'modifiedtime']")
@query("$orderBy")
$orderBy?: string;

@doc("Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned")
@query("$top")
$top?: int32;

@doc("Continuation token for pagination.")
@query("$skip")
$skip?: string;

@doc("Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2")
@query("$tags")
$tags?: string;

@doc("[ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType;
};

alias ListLatestDataSetVersionParameters = {
@doc("View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType;
};

interface Datasets
extends ServicePatterns.VersionedOperations<
DatasetVersion,
ListLatestDataSetVersionParameters,
ListDatasetVersionsParameters
> {
/**
* Create or start a pending upload of a dataset
*/
startPendingUpload is ServicePatterns.VersionedResourceAction<
Comment thread
johanste marked this conversation as resolved.
DatasetVersion,
PendingUploadRequest,
PendingUploadResponse
>;
}
14 changes: 1 addition & 13 deletions specification/ai/Azure.AI.Projects/indexes/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,14 @@ namespace Azure.AI.Projects;

@doc("Index resource Definition")
@discriminator("indexType")
@Rest.resource("indexes")
model Index {
@doc("Type of index")
indexType: IndexType;

...AssetBase;
}

@doc("Paged collection of Index items.")
@pagedResult
model PagedIndex {
@doc("The list of Indexes.")
@extension("x-ms-identifiers", [])
@items
value: Index[];

@doc("The link to the next page of items")
@nextLink
nextLink?: ResourceLocation<Index>;
}

@doc("Azure AI Search Index Definition")
model AzureAISearchIndex extends Index {
@doc("Type of index")
Expand Down
135 changes: 32 additions & 103 deletions specification/ai/Azure.AI.Projects/indexes/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "@azure-tools/typespec-autorest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "./models.tsp";
import "../servicepatterns.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
Expand All @@ -13,106 +14,34 @@ using Azure.Core.Foundations;

namespace Azure.AI.Projects;

interface Indexes {
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("List latest version of each dataset in a project.")
@route("/indexes")
@get
listLatestIndexes(
@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,
): PagedDatasetVersion;

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
@doc("Get a specific version of an Index.")
@route("/indexes/{name}/versions/{version}")
@get
get is Azure.Core.Foundations.Operation<
{
@doc("Name of the index.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-_]*$")
@maxLength(254)
@path
name: string;

@doc("Version of the index.")
@path
version: string;
},
Index
>;

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
@doc("Creates or updates a IndexVersion.")
@route("/indexes/{name}:create")
@post
createIndex is Azure.Core.Foundations.Operation<
{
@doc("Name of the index.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-_]*$")
@maxLength(254)
@path
name: string;

@doc("Properties of an Index Version.")
@bodyRoot
body: Index;
},
ResourceCreatedOrOkResponse<Index>
>;

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Need to use same model in both list calls."
@doc("List the versions of an Index given the name.")
@route("/indexes/{name}/versions")
@get
listIndexVersions is Azure.Core.Foundations.Operation<
{
@doc("Name of the index.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9-_]*$")
@maxLength(254)
@path
name: string;

@doc("View type for including/excluding (for example) archived entities.")
@query
listViewType: string = "ActiveOnly";

@doc("Ordering of list: Please choose orderby value from ['createdAt', 'lastModifiedAt'].")
@query
orderBy?: string;

@doc("Ordering of list: Please choose orderby value from ['createdAt', 'lastModifiedAt'].")
@query
orderby?: string;

@doc("Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2.")
@query
tags?: string;

...StandardListQueryParameters;
},
PagedIndex
>;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Delete version.")
@route("/indexes/{name}/versions/{version}")
@delete
deleteVersion(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,
): void;
}
alias ListIndexVersionParameters = {
@doc("View type for including/excluding (for example) archived entities.")
@query
listViewType: string = "ActiveOnly";

@doc("Ordering of list: Please choose orderby value from ['createdAt', 'lastModifiedAt'].")
@query
orderBy?: string;

@doc("Ordering of list: Please choose orderby value from ['createdAt', 'lastModifiedAt'].")
@query
orderby?: string;

@doc("Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2.")
@query
tags?: string;

...StandardListQueryParameters;
};

alias ListLatestIndexParameters = {
@doc("View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType;
};
interface Indexes
extends ServicePatterns.VersionedOperations<
Index,
ListLatestIndexParameters,
ListIndexVersionParameters
> {}
Loading