-
Notifications
You must be signed in to change notification settings - Fork 5.6k
1DP Azure AI Projects Typespec #33130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 125 commits
d47ca64
3b16f0c
7e3de07
c25ceb6
c23d2ef
de47def
7bc8b83
d752776
bf7ac9a
f8a1d4f
a19baec
3f424dc
25b8531
538face
eca12fc
b916218
3f26160
51b3511
efc3eaf
464cf9b
3daf517
fa63ef1
813f207
6c83724
c1fd302
7bd9414
bdfd6a3
23d5e2b
da96e87
37f9a36
1eeebba
82ca70a
6547b93
0d1be7a
71c492d
39e24ae
6140053
b42737c
07026b8
c7ab298
b717a1f
23361ff
459530a
cf4b9b8
6a6c061
ef6206d
cf6afcb
9c7951a
8c827c0
ddcad33
6da4036
b112157
b0c8c8f
620252d
e02c662
1470b01
c156acc
025e612
7f74f9d
91621e8
28ee55a
c83b455
3bde64e
4200597
dd26409
2d2713e
423cfa7
eba4829
5afee09
7afc1fc
94a064d
72c43a5
18ae7d3
224e34e
259fd62
8e92721
0358d69
7ef8a1b
7636ae6
38a557e
99c2ba2
0ff89ea
44bd943
253f637
b54a5bf
ee7434e
c6f364f
a42d770
8f4b306
6aa7a83
a2cf44d
a7ebee8
87ded34
fb20a8a
59765e4
146de83
ec313e9
b3f7bb6
7d7d9c1
7c15876
0e94eff
942a952
d88cedd
64e1df4
34fb652
f5cc96a
124f9c4
6808e70
158c805
ee66023
5281df4
cfbfe4a
ad7c697
fb7f51d
b348cf3
d167b37
e18c2b3
3daea95
1826d5d
3cad6f7
85bc07f
6c65932
18ac3fe
0f4d35b
8e6db4e
ca3a9a1
0f04d88
1de9b3d
88f1797
6e1b668
cffd345
fc0e897
a7c428f
c4cc5cf
eddee22
791e17a
12693f9
45d9ebe
8a44a2e
7169a24
ae3b04f
364bf26
1ada3b6
a1a907a
8bd4f87
287eea2
ef6f829
9f83acd
dfb5351
cef2df3
6955430
e4c203f
8de48d8
57e9831
2ba3e2e
be01be1
b12cfaa
11c4578
6f9fde3
a5177ca
04f19c9
0075ada
8c6ed71
101e4e0
07a63ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import "@azure-tools/typespec-client-generator-core"; | ||
| import "./main.tsp"; | ||
|
|
||
| using Azure.ClientGenerator.Core; | ||
|
|
||
| @@clientName(Azure.AI.Projects, "AIProjectClient"); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| import "@typespec/rest"; | ||
| import "@typespec/versioning"; | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
|
|
||
| using TypeSpec.Http; | ||
|
|
||
| namespace Azure.AI.Projects; | ||
|
|
||
| @doc("The available sorting options when requesting a list of response objects.") | ||
| union ListSortOrder { | ||
| string, | ||
|
|
||
| @doc("Specifies an ascending sort order.") | ||
| ascending: "asc", | ||
|
|
||
| @doc("Specifies a descending sort order.") | ||
| descending: "desc", | ||
| } | ||
|
|
||
| @doc("List View Type Definition") | ||
| union ListViewType { | ||
| string, | ||
|
|
||
| @doc("List only active items.") | ||
| ActiveOnly: "ActiveOnly", | ||
|
||
|
|
||
| @doc("List only archived items.") | ||
| ArchivedOnly: "ArchivedOnly", | ||
|
|
||
| @doc("List all items.") | ||
| All: "All", | ||
| } | ||
|
|
||
| alias AssetBase = { | ||
| @doc("Asset stage") | ||
| @visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update) | ||
| stage?: string; | ||
|
||
|
|
||
| @doc("A unique identifier for the asset, assetId probably?") | ||
| @visibility(Lifecycle.Read) | ||
| id?: string; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When would an asset not have an ID? |
||
|
|
||
| @doc("The name of the resource") | ||
| @visibility(Lifecycle.Read) | ||
| @key | ||
| name: string; | ||
|
|
||
| @doc("The version of the resource") | ||
| @visibility(Lifecycle.Read) | ||
| version: string; | ||
|
|
||
| @doc("The asset description text.") | ||
| @visibility(Lifecycle.Create, Lifecycle.Update) | ||
| description?: string; | ||
|
|
||
| @doc("Tag dictionary. Tags can be added, removed, and updated.") | ||
| @visibility(Lifecycle.Create, Lifecycle.Update) | ||
| tags?: Record<string>; | ||
| }; | ||
|
|
||
| #suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create responses correctly" | ||
| alias ResourceCreatedResponse<T extends TypeSpec.Reflection.Model> = TypeSpec.Http.Response<201> & | ||
| T; | ||
|
|
||
| #suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create responses correctly" | ||
| alias OkResponse<T extends TypeSpec.Reflection.Model> = TypeSpec.Http.Response<200> & | ||
| T; | ||
|
|
||
| // Pending upload spec | ||
|
|
||
| // Define a URI alias for clarity. | ||
| alias Uri = string; | ||
|
|
||
| @doc("The type of pending upload.") | ||
| union PendingUploadType { | ||
| string, | ||
|
|
||
| @doc("No pending upload.") | ||
| none: "None", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use Pascal case in the API. |
||
|
|
||
| @doc("Temporary Blob Reference is the only supported type.") | ||
| temporaryBlobReference: "TemporaryBlobReference", | ||
| } | ||
|
|
||
| @doc("The type of credential used to access the storage account.") | ||
| union PendingUploadCredentialType { | ||
| string, | ||
|
|
||
| @doc("SAS credential type.") | ||
| sas: "SAS", | ||
| } | ||
|
|
||
| @doc("Represents a request for a pending upload.") | ||
| model PendingUploadRequest { | ||
| @doc("If PendingUploadId is not provided, a random GUID will be used.") | ||
| pendingUploadId?: string; | ||
|
|
||
| @doc("Name of Azure blob storage connection to use for generating temporary SAS token") | ||
| connectionName?: string; | ||
|
|
||
| @doc("TemporaryBlobReference is the only supported type.") | ||
| pendingUploadType: PendingUploadType.temporaryBlobReference; | ||
| } | ||
|
|
||
| @doc("Represents the response for a pending upload request") | ||
| model PendingUploadResponse { | ||
| @doc("Container-level read, write, list SAS.") | ||
| blobReferenceForConsumption: BlobReferenceForConsumption; | ||
|
|
||
| @doc("ID for this upload request.") | ||
| pendingUploadId: string; | ||
|
|
||
| @doc("Version of dataset to be created if user did not specify version when initially creating upload") | ||
| datasetVersion?: string; | ||
|
|
||
| @doc("TemporaryBlobReference is the only supported type") | ||
| pendingUploadType: PendingUploadType.temporaryBlobReference; | ||
| } | ||
|
|
||
| @doc("SAS Credential definition") | ||
| model SasCredential { | ||
| @doc("SAS uri") | ||
| @visibility(Lifecycle.Read) | ||
| sasUri: string; | ||
|
|
||
| @visibility(Lifecycle.Read) | ||
| @doc("Type of credential") | ||
| type: "SAS"; | ||
| } | ||
|
|
||
| @doc("Represents a reference to a blob for consumption") | ||
| model BlobReferenceForConsumption { | ||
| @doc("Blob URI path for client to upload data. Example: https://blob.windows.core.net/Container/Path") | ||
| blobUri: Uri; | ||
|
|
||
| @doc("ARM ID of the storage account to use.") | ||
| storageAccountArmId: string; | ||
|
|
||
| @doc("Credential info to access the storage account.") | ||
| credential: SasCredential; | ||
| } | ||
|
|
||
| @doc("Represents a reference to a blob for consumption") | ||
| model AssetCredentialResponse { | ||
| @doc("Credential info to access the storage account.") | ||
| blobReferenceForConsumption: BlobReferenceForConsumption; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| import "@typespec/rest"; | ||
| import "@azure-tools/typespec-autorest"; | ||
| import "@typespec/versioning"; | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/versioning"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using TypeSpec.Versioning; | ||
|
|
||
| namespace Azure.AI.Projects; | ||
|
|
||
| @doc("Response from the list and get connections operations") | ||
| @resource("connections") | ||
| @added(Versions.v2025_05_01) | ||
| model Connection { | ||
dargilco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| @doc("The name of the resource") | ||
| @visibility(Lifecycle.Read) | ||
| @key("name") | ||
| name: string; | ||
|
|
||
| @doc("Category of the connection") | ||
| @visibility(Lifecycle.Read) | ||
| type: ConnectionType; | ||
|
|
||
| @doc("The connection URL to be used for this service") | ||
| @visibility(Lifecycle.Read) | ||
| target: string; | ||
|
|
||
| @doc("Whether the connection is tagged as the default connection of its type") | ||
| @visibility(Lifecycle.Read) | ||
| isDefault: boolean; | ||
|
|
||
| @doc("The credentials used by the connection") | ||
| @visibility(Lifecycle.Read) | ||
| credentials: BaseCredentials; | ||
|
|
||
| @doc("Metadata of the connection") | ||
| @visibility(Lifecycle.Read) | ||
| metadata: Record<string>; | ||
| } | ||
|
|
||
| @doc("A base class for connection credentials") | ||
| @discriminator("type") | ||
| model BaseCredentials { | ||
| @doc("The type of credential used by the connection") | ||
| @visibility(Lifecycle.Read) | ||
| type: CredentialType; | ||
| } | ||
|
|
||
| @doc("API Key Credential definition") | ||
| model ApiKeyCredentials extends BaseCredentials { | ||
| @doc("The credentail type") | ||
| @visibility(Lifecycle.Read) | ||
| type: CredentialType.apiKey; | ||
|
|
||
| @doc("API Key") | ||
| @visibility(Lifecycle.Read) | ||
| @encodedName("application/json", "key") | ||
| apiKey?: string; | ||
| } | ||
|
|
||
| #suppress "@azure-tools/typespec-azure-core/casing-style" | ||
| @doc("Entra ID credential definition") | ||
| model EntraIDCredentials extends BaseCredentials { | ||
| @doc("The credential type") | ||
| @visibility(Lifecycle.Read) | ||
| type: CredentialType.entraId; | ||
| } | ||
|
|
||
| @doc("Custom credential defintion") | ||
| model CustomCredential extends BaseCredentials { | ||
| @doc("The credential type") | ||
| @visibility(Lifecycle.Read) | ||
| type: CredentialType.custom; | ||
|
|
||
| @doc("The credential type") | ||
| @visibility(Lifecycle.Read) | ||
| keys: Record<string>; | ||
| } | ||
|
|
||
| #suppress "@azure-tools/typespec-azure-core/casing-style" | ||
| @doc("Shared Access Signature (SAS) credential definition") | ||
| model SASCredentials extends BaseCredentials { | ||
| @doc("The credential type") | ||
| @visibility(Lifecycle.Read) | ||
| type: CredentialType.SAS; | ||
|
|
||
| @doc("SAS token") | ||
| @visibility(Lifecycle.Read) | ||
| @encodedName("application/json", "SAS") | ||
| sasToken?: string; | ||
| } | ||
|
|
||
| @doc("Credentials that do not require authentication") | ||
| model NoAuthenticationCredentials extends BaseCredentials { | ||
| @doc("The credential type ") | ||
| @visibility(Lifecycle.Read) | ||
| type: CredentialType.None; | ||
| } | ||
|
|
||
| // https://learn.microsoft.com/rest/api/azureml/workspace-connections/list-secrets?view=rest-azureml-2024-04-01&tabs=HTTP#ConnectionType | ||
| @doc("The Type (or category) of the connection") | ||
| union ConnectionType { | ||
dargilco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| string, | ||
|
|
||
| @doc("Azure OpenAI Service") | ||
| AzureOpenAI: "AzureOpenAI", //TODO: In Python this results in .AZURE_OPEN_AI. How do I make it .AZURE_OPENAI? | ||
|
|
||
| @doc("Azure Blob Storage, with specified container") | ||
| AzureBlobStorage: "AzureBlob", | ||
|
|
||
| @doc("Azure Blob Storage, with container not specified (used by Agents)") | ||
| AzureStorageAccount: "AzureStorageAccount", | ||
|
|
||
| @doc("Azure AI Search") | ||
| AzureAISearch: "CognitiveSearch", | ||
|
|
||
| @doc("CosmosDB") | ||
| CosmosDB: "CosmosDB", | ||
|
|
||
| @doc("Generic connection that uses API Key authentication") | ||
| APIKey: "ApiKey", | ||
|
|
||
| @doc("Application Configuration") | ||
| ApplicationConfiguration: "AppConfig", | ||
|
|
||
| @doc("Application Insights") | ||
| ApplicationInsights: "AppInsights", | ||
|
|
||
| @doc("Custom Keys") | ||
| Custom: "CustomKeys", | ||
| } | ||
|
|
||
| @doc("The credential type used by the connection") | ||
| union CredentialType { | ||
| string, | ||
|
|
||
| @doc("API Key credential") | ||
| apiKey: "ApiKey", | ||
|
|
||
| @doc("Entra ID credential (formerly known as AAD)") | ||
| entraId: "AAD", | ||
|
|
||
| @doc("Shared Access Signature (SAS) credential") | ||
| SAS: "SAS", | ||
|
|
||
| @doc("Custom credential") | ||
| custom: "CustomKeys", | ||
|
|
||
| @doc("No credential") | ||
| None: "None", | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import "@typespec/rest"; | ||
| import "@azure-tools/typespec-autorest"; | ||
| import "@typespec/versioning"; | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "./models.tsp"; | ||
|
|
||
| using TypeSpec.Http; | ||
| using Azure.Core; | ||
| using Azure.Core.Traits; | ||
| using TypeSpec.Versioning; | ||
|
|
||
| namespace Azure.AI.Projects; | ||
|
|
||
| alias ConnectionServiceTraits = SupportsClientRequestId & | ||
| NoRepeatableRequests & | ||
| NoConditionalRequests; | ||
|
|
||
| alias ConnectionOperations = Azure.Core.ResourceOperations<ConnectionServiceTraits>; | ||
|
|
||
| @added(Versions.v2025_05_01) | ||
| interface Connections { | ||
| @doc("Get a connection by name, without populating connection credentials") | ||
| get is ConnectionOperations.ResourceRead<Connection>; | ||
dargilco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @doc("Get a connection by name, with its connection credentials") | ||
| @TypeSpec.Http.post | ||
| @Rest.actionSeparator("/") | ||
| @Rest.action("withCredentials") | ||
| getWithCredentials is ConnectionOperations.ResourceAction< | ||
| Connection, | ||
| {}, | ||
| Connection | ||
| >; | ||
|
|
||
| @doc("List all connections in the project, without populating connection credentials") | ||
| list is ConnectionOperations.ResourceList< | ||
| Connection, | ||
| ListQueryParametersTrait<{ | ||
| @doc("List connections of this specific type") | ||
| @query("connectionType") | ||
| connectionType?: ConnectionType; | ||
|
|
||
| @doc("List connections that are default connections") | ||
| @query("defaultConnection") | ||
| defaultConnection?: boolean; | ||
|
|
||
| ...StandardListQueryParameters; | ||
| }> | ||
| >; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What other orders would you expect to add? And since this is an input only enum, I don't think making it extensible is needed...