Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
93 changes: 82 additions & 11 deletions specification/ai/Azure.AI.Projects/connections/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ using TypeSpec.Versioning;

namespace Azure.AI.Projects;

@doc("Response from the listSecrets operation")
@doc("Response from the list and get connections operations")
@resource("connections")
@discriminator("authType")
@added(Versions.v2025_05_01)
model Connection {

@doc("The name of the resource")
@visibility(Lifecycle.Read)
@key("name")
Expand All @@ -27,15 +29,78 @@ model Connection {
@visibility(Lifecycle.Read)
target: string;

@doc("The authentication type used by the connection")
@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)
authType: AuthenticationType;
credentials: BaseCredentials;

@doc("Metadata of the connection")
@visibility(Lifecycle.Read)
metadata: Record<string>;
}

@doc("A base class for connection credentials")
@discriminator("authType")
model BaseCredentials {

@doc("The type of credential used by the connection")
@visibility(Lifecycle.Read)
authType: CredentialType;
}

@doc("API Key Credential definition")
model ApiKeyCredentials extends BaseCredentials {

@doc("The credentail type")
@visibility(Lifecycle.Read)
authType: CredentialType.apiKey;

@doc("API Key")
@visibility(Lifecycle.Read)
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)
authType: CredentialType.entraId;
}

@doc("Custom credential defintion")
model CustomCredential extends BaseCredentials {

@doc("The credential type ")
@visibility(Lifecycle.Read)
authType: CredentialType.custom;
}

#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)
authType: CredentialType.SAS;

@doc("SAS token")
@visibility(Lifecycle.Read)
sasToken?: string;
}

@doc("Credentials that do not require authentication")
model NoAuthenticationCredentials extends BaseCredentials {

@doc("The credential type ")
@visibility(Lifecycle.Read)
authType: 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 {
Expand All @@ -44,9 +109,12 @@ union ConnectionType {
@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")
@doc("Azure Blob Storage, with specified container")
AzureBlobStorage: "AzureBlob",

@doc("Azure Blob Storage, with container not specified (used by Assistants)")
AzureStorageAccount: "AzureStorageAccount",

@doc("Azure AI Search")
AzureAISearch: "CognitiveSearch",

Expand All @@ -56,29 +124,32 @@ union ConnectionType {
@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 authentication type used by the connection")
union AuthenticationType {
@doc("The credential type used by the connection")
union CredentialType {
string,

@doc("API Key authentication")
@doc("API Key credential")
apiKey: "ApiKey",

@doc("Entra ID authentication (formerly known as AAD)")
@doc("Entra ID credential (formerly known as AAD)")
entraId: "AAD",

@doc("Shared Access Signature (SAS) authentication")
@doc("Shared Access Signature (SAS) credential")
SAS: "SAS",

@doc("Custom authentication")
@doc("Custom credential")
custom: "CustomKeys",

@doc("No authentication")
@doc("No credential")
None: "None",
}
14 changes: 11 additions & 3 deletions specification/ai/Azure.AI.Projects/connections/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,25 @@ alias ConnectionOperations = Azure.Core.ResourceOperations<ConnectionServiceTrai

@added(Versions.v2025_05_01)
interface Connections {
@doc("Get a connection by name.")
@doc("Get a connection by name, without populating connection credentials")
get is ConnectionOperations.ResourceRead<Connection>;

@doc("List all connections in the project")
@doc("Get a connection by name, with its connection credentials")
@Rest.actionSeparator("/")
@Rest.action("withCredentials")
getWithCredentials is ConnectionOperations.ResourceRead<Connection>;
@doc("List all connections in the project, without populating connection credentials")
list is ConnectionOperations.ResourceList<
Connection,
ListQueryParametersTrait<{
@doc("Specific type of connection to return in list")
@doc("List connections of this specific type")
@query("connectionType")
connectionType?: ConnectionType;

@doc("List connections that are default connections")
@query("defaultConnection")
defaultConnection?: boolean;

...StandardListQueryParameters;
}>
>;
Expand Down
2 changes: 2 additions & 0 deletions specification/ai/Azure.AI.Projects/datasets/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ interface Datasets
PendingUploadResponse
>;

/* Reenable this once the service supports "unversioned" dataset operations
@doc("Start a new pending upload for a dataset. The version id will be generated by the service.")
@Rest.actionSeparator("/")
@Rest.action("startPendingUpload")
Expand All @@ -55,4 +56,5 @@ interface Datasets
PendingUploadRequest,
PendingUploadResponse
>;
*/
}
4 changes: 4 additions & 0 deletions specification/ai/Azure.AI.Projects/servicepatterns.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace Azure.AI.Projects.ServicePatterns {
Http.NoContentResponse
>;

/* Reenable this once the service supports "unversioned" operations
@doc(
"Create a new {name}. The version id will be generated by the service.",
TEntityType
Expand All @@ -69,6 +70,7 @@ namespace Azure.AI.Projects.ServicePatterns {
},
TEntityType
>;
*/

@doc(
"Create a new or replace an existing {name} with the given version id",
Expand Down Expand Up @@ -114,6 +116,7 @@ namespace Azure.AI.Projects.ServicePatterns {
TResponse
>;

/* Reenable this once the service supports "unversioned" operations
@Rest.action
op UnversionedResourceAction<
TEntityType extends Reflection.Model,
Expand All @@ -128,6 +131,7 @@ namespace Azure.AI.Projects.ServicePatterns {
},
TResponse
>;
*/

namespace BuildingBlocks {
alias CoreOps = Azure.Core.StandardResourceOperations;
Expand Down
Loading
Loading