diff --git a/sdk/ai/Azure.AI.Connections/Azure.AI.Connections.sln b/sdk/ai/Azure.AI.Connections/Azure.AI.Connections.sln
new file mode 100644
index 000000000000..608fea111f94
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/Azure.AI.Connections.sln
@@ -0,0 +1,56 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Connections", "src\Azure.AI.Connections.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Connections.Tests", "tests\Azure.AI.Connections.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/ai/Azure.AI.Connections/CHANGELOG.md b/sdk/ai/Azure.AI.Connections/CHANGELOG.md
new file mode 100644
index 000000000000..8b33f0fedccc
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/CHANGELOG.md
@@ -0,0 +1,11 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
\ No newline at end of file
diff --git a/sdk/ai/Azure.AI.Connections/Directory.Build.props b/sdk/ai/Azure.AI.Connections/Directory.Build.props
new file mode 100644
index 000000000000..63bd836ad44b
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/ai/Azure.AI.Connections/README.md b/sdk/ai/Azure.AI.Connections/README.md
new file mode 100644
index 000000000000..7efefaa2c8fe
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/README.md
@@ -0,0 +1,107 @@
+# Azure.AI.Connections client library for .NET
+
+Azure.AI.Connections is a managed service that helps developers get secret simply and securely.
+
+Use the client library for to:
+
+* [Get secret](https://docs.microsoft.com/azure)
+
+[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples]
+
+ [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/ai/Azure.AI.Connections/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure)
+
+## Getting started
+
+This section should include everything a developer needs to do to install and create their first client connection *very quickly*.
+
+### Install the package
+
+First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository.
+
+Install the client library for .NET with [NuGet](https://www.nuget.org/ ):
+
+```dotnetcli
+dotnet add package Azure.AI.Connections --prerelease
+```
+
+### Prerequisites
+
+Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB:
+
+> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`.
+
+### Authenticate the client
+
+If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating.
+
+For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object.
+
+### Service API versions
+
+The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate.
+
+#### Select a service API version
+
+You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version.
+
+For example,
+
+```C# Snippet:CreateClientForSpecificApiVersion
+Uri endpoint = new Uri("");
+DefaultAzureCredential credential = new DefaultAzureCredential();
+ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.)
+var client = new Client(endpoint, credential, options);
+```
+
+When selecting an API version, it's important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility.
+
+Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy.
+
+## Key concepts
+
+The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity.
+
+Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of:
+
+### Thread safety
+
+We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads.
+
+### Additional concepts
+
+[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) |
+[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) |
+[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) |
+[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) |
+[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) |
+[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) |
+[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/)
+
+
+## Examples
+
+You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Connections/samples).
+
+## Troubleshooting
+
+Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery.
+
+Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API.
+
+If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code.
+
+## Next steps
+
+* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory.
+* If appropriate, point users to other packages that might be useful.
+* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for.
+
+## Contributing
+
+This is a template, but your SDK readme should include details on how to contribute code to the repo/package.
+
+
+[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
+[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
+
+
\ No newline at end of file
diff --git a/sdk/ai/Azure.AI.Connections/api/Azure.AI.Connections.net8.0.cs b/sdk/ai/Azure.AI.Connections/api/Azure.AI.Connections.net8.0.cs
new file mode 100644
index 000000000000..0a28f569fc98
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/api/Azure.AI.Connections.net8.0.cs
@@ -0,0 +1,41 @@
+namespace Azure.AI.Connections
+{
+ public partial class AIConnectionsClient
+ {
+ protected AIConnectionsClient() { }
+ public AIConnectionsClient(System.Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, Azure.Core.TokenCredential credential) { }
+ public AIConnectionsClient(System.Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, Azure.Core.TokenCredential credential, Azure.AI.Connections.AIConnectionsClientOptions options) { }
+ public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
+ }
+ public partial class AIConnectionsClientOptions : Azure.Core.ClientOptions
+ {
+ public AIConnectionsClientOptions(Azure.AI.Connections.AIConnectionsClientOptions.ServiceVersion version = Azure.AI.Connections.AIConnectionsClientOptions.ServiceVersion.V2024_07_01_Preview) { }
+ public enum ServiceVersion
+ {
+ V2024_07_01_Preview = 1,
+ }
+ }
+ public enum AuthenticationType
+ {
+ ApiKey = 0,
+ EntraId = 1,
+ SAS = 2,
+ None = 3,
+ }
+ public enum ConnectionType
+ {
+ AzureOpenAI = 0,
+ Serverless = 1,
+ AzureBlobStorage = 2,
+ AzureAIServices = 3,
+ AzureAISearch = 4,
+ }
+}
+namespace Microsoft.Extensions.Azure
+{
+ public static partial class AIConnectionsClientBuilderExtensions
+ {
+ public static Azure.Core.Extensions.IAzureClientBuilder AddAIConnectionsClient(this TBuilder builder, System.Uri endpoint, string subscriptionId, string resourceGroupName, string projectName) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; }
+ public static Azure.Core.Extensions.IAzureClientBuilder AddAIConnectionsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Connections/api/Azure.AI.Connections.netstandard2.0.cs b/sdk/ai/Azure.AI.Connections/api/Azure.AI.Connections.netstandard2.0.cs
new file mode 100644
index 000000000000..0a28f569fc98
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/api/Azure.AI.Connections.netstandard2.0.cs
@@ -0,0 +1,41 @@
+namespace Azure.AI.Connections
+{
+ public partial class AIConnectionsClient
+ {
+ protected AIConnectionsClient() { }
+ public AIConnectionsClient(System.Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, Azure.Core.TokenCredential credential) { }
+ public AIConnectionsClient(System.Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, Azure.Core.TokenCredential credential, Azure.AI.Connections.AIConnectionsClientOptions options) { }
+ public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
+ }
+ public partial class AIConnectionsClientOptions : Azure.Core.ClientOptions
+ {
+ public AIConnectionsClientOptions(Azure.AI.Connections.AIConnectionsClientOptions.ServiceVersion version = Azure.AI.Connections.AIConnectionsClientOptions.ServiceVersion.V2024_07_01_Preview) { }
+ public enum ServiceVersion
+ {
+ V2024_07_01_Preview = 1,
+ }
+ }
+ public enum AuthenticationType
+ {
+ ApiKey = 0,
+ EntraId = 1,
+ SAS = 2,
+ None = 3,
+ }
+ public enum ConnectionType
+ {
+ AzureOpenAI = 0,
+ Serverless = 1,
+ AzureBlobStorage = 2,
+ AzureAIServices = 3,
+ AzureAISearch = 4,
+ }
+}
+namespace Microsoft.Extensions.Azure
+{
+ public static partial class AIConnectionsClientBuilderExtensions
+ {
+ public static Azure.Core.Extensions.IAzureClientBuilder AddAIConnectionsClient(this TBuilder builder, System.Uri endpoint, string subscriptionId, string resourceGroupName, string projectName) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; }
+ public static Azure.Core.Extensions.IAzureClientBuilder AddAIConnectionsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Connections/src/Azure.AI.Connections.csproj b/sdk/ai/Azure.AI.Connections/src/Azure.AI.Connections.csproj
new file mode 100644
index 000000000000..20302902321b
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/src/Azure.AI.Connections.csproj
@@ -0,0 +1,19 @@
+
+
+ This is the Azure.AI.Connections client library for developing .NET applications with rich experience.
+ Azure SDK Code Generation Azure.AI.Connections for Azure Data Plane
+ 1.0.0-beta.1
+ Azure.AI.Connections
+ $(RequiredTargetFrameworks)
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClient.cs b/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClient.cs
new file mode 100644
index 000000000000..d63e12c54a1e
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClient.cs
@@ -0,0 +1,598 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.AI.Connections
+{
+ // Data plane generated client.
+ /// The AIConnections service client.
+ public partial class AIConnectionsClient
+ {
+ private static readonly string[] AuthorizationScopes = new string[] { "https://management.azure.com/.default" };
+ private readonly TokenCredential _tokenCredential;
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+ private readonly string _subscriptionId;
+ private readonly string _resourceGroupName;
+ private readonly string _projectName;
+ private readonly string _apiVersion;
+
+ /// The ClientDiagnostics is used to provide tracing support for the client library.
+ internal ClientDiagnostics ClientDiagnostics { get; }
+
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ public virtual HttpPipeline Pipeline => _pipeline;
+
+ /// Initializes a new instance of AIConnectionsClient for mocking.
+ protected AIConnectionsClient()
+ {
+ }
+
+ /// Initializes a new instance of AIConnectionsClient.
+ /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link.
+ /// The Azure subscription ID.
+ /// The name of the Azure Resource Group.
+ /// The Azure AI Foundry project name.
+ /// A credential used to authenticate to an Azure Service.
+ /// , , , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public AIConnectionsClient(Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, TokenCredential credential) : this(endpoint, subscriptionId, resourceGroupName, projectName, credential, new AIConnectionsClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of AIConnectionsClient.
+ /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link.
+ /// The Azure subscription ID.
+ /// The name of the Azure Resource Group.
+ /// The Azure AI Foundry project name.
+ /// A credential used to authenticate to an Azure Service.
+ /// The options for configuring the client.
+ /// , , , or is null.
+ /// , or is an empty string, and was expected to be non-empty.
+ public AIConnectionsClient(Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, TokenCredential credential, AIConnectionsClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
+ Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
+ Argument.AssertNotNullOrEmpty(projectName, nameof(projectName));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new AIConnectionsClientOptions();
+
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _tokenCredential = credential;
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier());
+ _endpoint = endpoint;
+ _subscriptionId = subscriptionId;
+ _resourceGroupName = resourceGroupName;
+ _projectName = projectName;
+ _apiVersion = options.Version;
+ }
+
+ /// Gets the properties of the specified machine learning workspace.
+ /// The cancellation token to use.
+ internal virtual async Task> GetWorkspaceAsync(CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetWorkspaceAsync(context).ConfigureAwait(false);
+ return Response.FromValue(GetWorkspaceResponse.FromResponse(response), response);
+ }
+
+ /// Gets the properties of the specified machine learning workspace.
+ /// The cancellation token to use.
+ internal virtual Response GetWorkspace(CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetWorkspace(context);
+ return Response.FromValue(GetWorkspaceResponse.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets the properties of the specified machine learning workspace.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task GetWorkspaceAsync(RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AIConnectionsClient.GetWorkspace");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetWorkspaceRequest(context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets the properties of the specified machine learning workspace.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response GetWorkspace(RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AIConnectionsClient.GetWorkspace");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetWorkspaceRequest(context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// List the details of all the connections (not including their credentials).
+ /// Category of the workspace connection.
+ /// Indicates whether to list datastores. Service default: do not list datastores.
+ /// Target of the workspace connection.
+ /// The cancellation token to use.
+ internal virtual async Task> GetConnectionsAsync(ConnectionType? category = null, bool? includeAll = null, string target = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetConnectionsAsync(category?.ToSerialString(), includeAll, target, context).ConfigureAwait(false);
+ return Response.FromValue(ListConnectionsResponse.FromResponse(response), response);
+ }
+
+ /// List the details of all the connections (not including their credentials).
+ /// Category of the workspace connection.
+ /// Indicates whether to list datastores. Service default: do not list datastores.
+ /// Target of the workspace connection.
+ /// The cancellation token to use.
+ internal virtual Response GetConnections(ConnectionType? category = null, bool? includeAll = null, string target = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetConnections(category?.ToSerialString(), includeAll, target, context);
+ return Response.FromValue(ListConnectionsResponse.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] List the details of all the connections (not including their credentials)
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Category of the workspace connection. Allowed values: "AzureOpenAI" | "Serverless" | "AzureBlob" | "AIServices" | "CognitiveSearch".
+ /// Indicates whether to list datastores. Service default: do not list datastores.
+ /// Target of the workspace connection.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task GetConnectionsAsync(string category, bool? includeAll, string target, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AIConnectionsClient.GetConnections");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetConnectionsRequest(category, includeAll, target, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] List the details of all the connections (not including their credentials)
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Category of the workspace connection. Allowed values: "AzureOpenAI" | "Serverless" | "AzureBlob" | "AIServices" | "CognitiveSearch".
+ /// Indicates whether to list datastores. Service default: do not list datastores.
+ /// Target of the workspace connection.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response GetConnections(string category, bool? includeAll, string target, RequestContext context)
+ {
+ using var scope = ClientDiagnostics.CreateScope("AIConnectionsClient.GetConnections");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetConnectionsRequest(category, includeAll, target, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get the details of a single connection, without credentials.
+ /// Connection Name.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ internal virtual async Task> GetConnectionAsync(string connectionName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetConnectionAsync(connectionName, context).ConfigureAwait(false);
+ return Response.FromValue(GetConnectionResponse.FromResponse(response), response);
+ }
+
+ /// Get the details of a single connection, without credentials.
+ /// Connection Name.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ internal virtual Response GetConnection(string connectionName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetConnection(connectionName, context);
+ return Response.FromValue(GetConnectionResponse.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Get the details of a single connection, without credentials.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Connection Name.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task GetConnectionAsync(string connectionName, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName));
+
+ using var scope = ClientDiagnostics.CreateScope("AIConnectionsClient.GetConnection");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetConnectionRequest(connectionName, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Get the details of a single connection, without credentials.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Connection Name.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response GetConnection(string connectionName, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName));
+
+ using var scope = ClientDiagnostics.CreateScope("AIConnectionsClient.GetConnection");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetConnectionRequest(connectionName, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get the details of a single connection, including credentials (if available).
+ /// Connection Name.
+ /// The body is ignored. TODO: Can we remove this?.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ internal virtual async Task> GetConnectionWithSecretsAsync(string connectionName, string ignored, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName));
+ Argument.AssertNotNull(ignored, nameof(ignored));
+
+ GetConnectionWithSecretsRequest getConnectionWithSecretsRequest = new GetConnectionWithSecretsRequest(ignored, null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetConnectionWithSecretsAsync(connectionName, getConnectionWithSecretsRequest.ToRequestContent(), context).ConfigureAwait(false);
+ return Response.FromValue(GetConnectionResponse.FromResponse(response), response);
+ }
+
+ /// Get the details of a single connection, including credentials (if available).
+ /// Connection Name.
+ /// The body is ignored. TODO: Can we remove this?.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ internal virtual Response GetConnectionWithSecrets(string connectionName, string ignored, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName));
+ Argument.AssertNotNull(ignored, nameof(ignored));
+
+ GetConnectionWithSecretsRequest getConnectionWithSecretsRequest = new GetConnectionWithSecretsRequest(ignored, null);
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetConnectionWithSecrets(connectionName, getConnectionWithSecretsRequest.ToRequestContent(), context);
+ return Response.FromValue(GetConnectionResponse.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Get the details of a single connection, including credentials (if available).
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Connection Name.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual async Task GetConnectionWithSecretsAsync(string connectionName, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AIConnectionsClient.GetConnectionWithSecrets");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetConnectionWithSecretsRequest(connectionName, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Get the details of a single connection, including credentials (if available).
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Connection Name.
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ internal virtual Response GetConnectionWithSecrets(string connectionName, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(connectionName, nameof(connectionName));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("AIConnectionsClient.GetConnectionWithSecrets");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetConnectionWithSecretsRequest(connectionName, content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ internal HttpMessage CreateGetWorkspaceRequest(RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendRaw("/agents/v1.0/subscriptions/", false);
+ uri.AppendRaw(_subscriptionId, true);
+ uri.AppendRaw("/resourceGroups/", false);
+ uri.AppendRaw(_resourceGroupName, true);
+ uri.AppendRaw("/providers/Microsoft.MachineLearningServices/workspaces/", false);
+ uri.AppendRaw(_projectName, true);
+ uri.AppendPath("/", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetConnectionsRequest(string category, bool? includeAll, string target, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendRaw("/agents/v1.0/subscriptions/", false);
+ uri.AppendRaw(_subscriptionId, true);
+ uri.AppendRaw("/resourceGroups/", false);
+ uri.AppendRaw(_resourceGroupName, true);
+ uri.AppendRaw("/providers/Microsoft.MachineLearningServices/workspaces/", false);
+ uri.AppendRaw(_projectName, true);
+ uri.AppendPath("/connections", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ if (category != null)
+ {
+ uri.AppendQuery("category", category, true);
+ }
+ if (includeAll != null)
+ {
+ uri.AppendQuery("includeAll", includeAll.Value, true);
+ }
+ if (target != null)
+ {
+ uri.AppendQuery("target", target, true);
+ }
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetConnectionRequest(string connectionName, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendRaw("/agents/v1.0/subscriptions/", false);
+ uri.AppendRaw(_subscriptionId, true);
+ uri.AppendRaw("/resourceGroups/", false);
+ uri.AppendRaw(_resourceGroupName, true);
+ uri.AppendRaw("/providers/Microsoft.MachineLearningServices/workspaces/", false);
+ uri.AppendRaw(_projectName, true);
+ uri.AppendPath("/connections/", false);
+ uri.AppendPath(connectionName, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetConnectionWithSecretsRequest(string connectionName, RequestContent content, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendRaw("/agents/v1.0/subscriptions/", false);
+ uri.AppendRaw(_subscriptionId, true);
+ uri.AppendRaw("/resourceGroups/", false);
+ uri.AppendRaw(_resourceGroupName, true);
+ uri.AppendRaw("/providers/Microsoft.MachineLearningServices/workspaces/", false);
+ uri.AppendRaw(_projectName, true);
+ uri.AppendPath("/connections/", false);
+ uri.AppendPath(connectionName, true);
+ uri.AppendPath("/listsecrets", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ private static RequestContext DefaultRequestContext = new RequestContext();
+ internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default)
+ {
+ if (!cancellationToken.CanBeCanceled)
+ {
+ return DefaultRequestContext;
+ }
+
+ return new RequestContext() { CancellationToken = cancellationToken };
+ }
+
+ private static ResponseClassifier _responseClassifier200;
+ private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 });
+ }
+}
diff --git a/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClientBuilderExtensions.cs b/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClientBuilderExtensions.cs
new file mode 100644
index 000000000000..5a598af2699c
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClientBuilderExtensions.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.AI.Connections;
+using Azure.Core.Extensions;
+
+namespace Microsoft.Extensions.Azure
+{
+ /// Extension methods to add to client builder.
+ public static partial class AIConnectionsClientBuilderExtensions
+ {
+ /// Registers a instance.
+ /// The builder to register with.
+ /// The Azure AI Foundry project endpoint, in the form `https://<azure-region>.api.azureml.ms` or `https://<private-link-guid>.<azure-region>.api.azureml.ms`, where <azure-region> is the Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of the Enterprise private link.
+ /// The Azure subscription ID.
+ /// The name of the Azure Resource Group.
+ /// The Azure AI Foundry project name.
+ public static IAzureClientBuilder AddAIConnectionsClient(this TBuilder builder, Uri endpoint, string subscriptionId, string resourceGroupName, string projectName)
+ where TBuilder : IAzureClientFactoryBuilderWithCredential
+ {
+ return builder.RegisterClientFactory((options, cred) => new AIConnectionsClient(endpoint, subscriptionId, resourceGroupName, projectName, cred, options));
+ }
+
+ /// Registers a instance.
+ /// The builder to register with.
+ /// The configuration values.
+ public static IAzureClientBuilder AddAIConnectionsClient(this TBuilder builder, TConfiguration configuration)
+ where TBuilder : IAzureClientFactoryBuilderWithConfiguration
+ {
+ return builder.RegisterClientFactory(configuration);
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClientOptions.cs b/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClientOptions.cs
new file mode 100644
index 000000000000..265f527e620e
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/AIConnectionsClientOptions.cs
@@ -0,0 +1,37 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.AI.Connections
+{
+ /// Client options for AIConnectionsClient.
+ public partial class AIConnectionsClientOptions : ClientOptions
+ {
+ private const ServiceVersion LatestVersion = ServiceVersion.V2024_07_01_Preview;
+
+ /// The version of the service to use.
+ public enum ServiceVersion
+ {
+ /// Service version "2024-07-01-preview".
+ V2024_07_01_Preview = 1,
+ }
+
+ internal string Version { get; }
+
+ /// Initializes new instance of AIConnectionsClientOptions.
+ public AIConnectionsClientOptions(ServiceVersion version = LatestVersion)
+ {
+ Version = version switch
+ {
+ ServiceVersion.V2024_07_01_Preview => "2024-07-01-preview",
+ _ => throw new NotSupportedException()
+ };
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.Serialization.cs b/sdk/ai/Azure.AI.Connections/src/Generated/AuthenticationType.Serialization.cs
similarity index 97%
rename from sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.Serialization.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/AuthenticationType.Serialization.cs
index c64772bece56..ff23245a892f 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.Serialization.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/AuthenticationType.Serialization.cs
@@ -7,7 +7,7 @@
using System;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
internal static partial class AuthenticationTypeExtensions
{
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.cs b/sdk/ai/Azure.AI.Connections/src/Generated/AuthenticationType.cs
similarity index 95%
rename from sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/AuthenticationType.cs
index 70ef54413110..e538e6ba3725 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/AuthenticationType.cs
@@ -5,7 +5,7 @@
#nullable disable
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
/// Authentication type used by Azure AI service to connect to another service.
public enum AuthenticationType
diff --git a/sdk/ai/Azure.AI.Connections/src/Generated/ConnectionType.Serialization.cs b/sdk/ai/Azure.AI.Connections/src/Generated/ConnectionType.Serialization.cs
new file mode 100644
index 000000000000..dbed09712997
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/ConnectionType.Serialization.cs
@@ -0,0 +1,34 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.AI.Connections
+{
+ internal static partial class ConnectionTypeExtensions
+ {
+ public static string ToSerialString(this ConnectionType value) => value switch
+ {
+ ConnectionType.AzureOpenAI => "AzureOpenAI",
+ ConnectionType.Serverless => "Serverless",
+ ConnectionType.AzureBlobStorage => "AzureBlob",
+ ConnectionType.AzureAIServices => "AIServices",
+ ConnectionType.AzureAISearch => "CognitiveSearch",
+ _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ConnectionType value.")
+ };
+
+ public static ConnectionType ToConnectionType(this string value)
+ {
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "AzureOpenAI")) return ConnectionType.AzureOpenAI;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "Serverless")) return ConnectionType.Serverless;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "AzureBlob")) return ConnectionType.AzureBlobStorage;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "AIServices")) return ConnectionType.AzureAIServices;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "CognitiveSearch")) return ConnectionType.AzureAISearch;
+ throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ConnectionType value.");
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Connections/src/Generated/ConnectionType.cs b/sdk/ai/Azure.AI.Connections/src/Generated/ConnectionType.cs
new file mode 100644
index 000000000000..9b964fa77f18
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/ConnectionType.cs
@@ -0,0 +1,24 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.AI.Connections
+{
+ /// The Type (or category) of the connection.
+ public enum ConnectionType
+ {
+ /// Azure OpenAI Service.
+ AzureOpenAI,
+ /// Serverless API Service.
+ Serverless,
+ /// Azure Blob Storage.
+ AzureBlobStorage,
+ /// Azure AI Services.
+ AzureAIServices,
+ /// Azure AI Search.
+ AzureAISearch
+ }
+}
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CredentialsApiKeyAuth.Serialization.cs b/sdk/ai/Azure.AI.Connections/src/Generated/CredentialsApiKeyAuth.Serialization.cs
similarity index 97%
rename from sdk/ai/Azure.AI.Projects/src/Generated/CredentialsApiKeyAuth.Serialization.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/CredentialsApiKeyAuth.Serialization.cs
index 4be6577c2b04..af4c21d585a5 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/CredentialsApiKeyAuth.Serialization.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/CredentialsApiKeyAuth.Serialization.cs
@@ -11,9 +11,9 @@
using System.Text.Json;
using Azure.Core;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
- public partial class CredentialsApiKeyAuth : IUtf8JsonSerializable, IJsonModel
+ internal partial class CredentialsApiKeyAuth : IUtf8JsonSerializable, IJsonModel
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CredentialsApiKeyAuth.cs b/sdk/ai/Azure.AI.Connections/src/Generated/CredentialsApiKeyAuth.cs
similarity index 97%
rename from sdk/ai/Azure.AI.Projects/src/Generated/CredentialsApiKeyAuth.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/CredentialsApiKeyAuth.cs
index 97faa0c97097..1c92a2fc426f 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/CredentialsApiKeyAuth.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/CredentialsApiKeyAuth.cs
@@ -8,10 +8,10 @@
using System;
using System.Collections.Generic;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
/// The credentials needed for API key authentication.
- public partial class CredentialsApiKeyAuth
+ internal partial class CredentialsApiKeyAuth
{
///
/// Keeps track of any properties unknown to the library.
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CredentialsSASAuth.Serialization.cs b/sdk/ai/Azure.AI.Connections/src/Generated/CredentialsSASAuth.Serialization.cs
similarity index 99%
rename from sdk/ai/Azure.AI.Projects/src/Generated/CredentialsSASAuth.Serialization.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/CredentialsSASAuth.Serialization.cs
index 785bb62e41bb..d72935722d88 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/CredentialsSASAuth.Serialization.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/CredentialsSASAuth.Serialization.cs
@@ -11,7 +11,7 @@
using System.Text.Json;
using Azure.Core;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
internal partial class CredentialsSASAuth : IUtf8JsonSerializable, IJsonModel
{
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/CredentialsSASAuth.cs b/sdk/ai/Azure.AI.Connections/src/Generated/CredentialsSASAuth.cs
similarity index 98%
rename from sdk/ai/Azure.AI.Projects/src/Generated/CredentialsSASAuth.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/CredentialsSASAuth.cs
index 5bf56c6a308c..8e43fc060f0d 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/CredentialsSASAuth.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/CredentialsSASAuth.cs
@@ -8,7 +8,7 @@
using System;
using System.Collections.Generic;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
/// The credentials needed for Shared Access Signatures (SAS) authentication.
internal partial class CredentialsSASAuth
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.Serialization.cs b/sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionResponse.Serialization.cs
similarity index 65%
rename from sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.Serialization.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionResponse.Serialization.cs
index 0b803a55213b..b63dbc87776b 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.Serialization.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionResponse.Serialization.cs
@@ -11,13 +11,13 @@
using System.Text.Json;
using Azure.Core;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
- public partial class ConnectionResponse : IUtf8JsonSerializable, IJsonModel
+ internal partial class GetConnectionResponse : IUtf8JsonSerializable, IJsonModel
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
- void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
writer.WriteStartObject();
JsonModelWriteCore(writer, options);
@@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit
/// The client options for reading and writing models.
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
- throw new FormatException($"The model {nameof(ConnectionResponse)} does not support writing '{format}' format.");
+ throw new FormatException($"The model {nameof(GetConnectionResponse)} does not support writing '{format}' format.");
}
writer.WritePropertyName("id"u8);
@@ -57,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
}
}
- ConnectionResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ GetConnectionResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
- throw new FormatException($"The model {nameof(ConnectionResponse)} does not support reading '{format}' format.");
+ throw new FormatException($"The model {nameof(GetConnectionResponse)} does not support reading '{format}' format.");
}
using JsonDocument document = JsonDocument.ParseValue(ref reader);
- return DeserializeConnectionResponse(document.RootElement, options);
+ return DeserializeGetConnectionResponse(document.RootElement, options);
}
- internal static ConnectionResponse DeserializeConnectionResponse(JsonElement element, ModelReaderWriterOptions options = null)
+ internal static GetConnectionResponse DeserializeGetConnectionResponse(JsonElement element, ModelReaderWriterOptions options = null)
{
options ??= ModelSerializationExtensions.WireOptions;
@@ -79,7 +79,7 @@ internal static ConnectionResponse DeserializeConnectionResponse(JsonElement ele
}
string id = default;
string name = default;
- ConnectionProperties properties = default;
+ InternalConnectionProperties properties = default;
IDictionary serializedAdditionalRawData = default;
Dictionary rawDataDictionary = new Dictionary();
foreach (var property in element.EnumerateObject())
@@ -96,7 +96,7 @@ internal static ConnectionResponse DeserializeConnectionResponse(JsonElement ele
}
if (property.NameEquals("properties"u8))
{
- properties = ConnectionProperties.DeserializeConnectionProperties(property.Value, options);
+ properties = InternalConnectionProperties.DeserializeInternalConnectionProperties(property.Value, options);
continue;
}
if (options.Format != "W")
@@ -105,46 +105,46 @@ internal static ConnectionResponse DeserializeConnectionResponse(JsonElement ele
}
}
serializedAdditionalRawData = rawDataDictionary;
- return new ConnectionResponse(id, name, properties, serializedAdditionalRawData);
+ return new GetConnectionResponse(id, name, properties, serializedAdditionalRawData);
}
- BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
return ModelReaderWriter.Write(this, options);
default:
- throw new FormatException($"The model {nameof(ConnectionResponse)} does not support writing '{options.Format}' format.");
+ throw new FormatException($"The model {nameof(GetConnectionResponse)} does not support writing '{options.Format}' format.");
}
}
- ConnectionResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ GetConnectionResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
{
using JsonDocument document = JsonDocument.Parse(data);
- return DeserializeConnectionResponse(document.RootElement, options);
+ return DeserializeGetConnectionResponse(document.RootElement, options);
}
default:
- throw new FormatException($"The model {nameof(ConnectionResponse)} does not support reading '{options.Format}' format.");
+ throw new FormatException($"The model {nameof(GetConnectionResponse)} does not support reading '{options.Format}' format.");
}
}
- string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
/// Deserializes the model from a raw response.
/// The response to deserialize the model from.
- internal static ConnectionResponse FromResponse(Response response)
+ internal static GetConnectionResponse FromResponse(Response response)
{
using var document = JsonDocument.Parse(response.Content);
- return DeserializeConnectionResponse(document.RootElement);
+ return DeserializeGetConnectionResponse(document.RootElement);
}
/// Convert into a .
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.cs b/sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionResponse.cs
similarity index 57%
rename from sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionResponse.cs
index 0197ccf697dc..44b2fb3f8d5d 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionResponse.cs
@@ -8,10 +8,10 @@
using System;
using System.Collections.Generic;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
/// Response from the listSecrets operation.
- public partial class ConnectionResponse
+ internal partial class GetConnectionResponse
{
///
/// Keeps track of any properties unknown to the library.
@@ -45,16 +45,16 @@ public partial class ConnectionResponse
///
private IDictionary _serializedAdditionalRawData;
- /// Initializes a new instance of .
+ /// Initializes a new instance of .
/// A unique identifier for the connection.
/// The name of the resource.
///
/// The properties of the resource
- /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
- /// The available derived classes include and .
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , , and .
///
/// , or is null.
- internal ConnectionResponse(string id, string name, ConnectionProperties properties)
+ internal GetConnectionResponse(string id, string name, InternalConnectionProperties properties)
{
Argument.AssertNotNull(id, nameof(id));
Argument.AssertNotNull(name, nameof(name));
@@ -65,16 +65,16 @@ internal ConnectionResponse(string id, string name, ConnectionProperties propert
Properties = properties;
}
- /// Initializes a new instance of .
+ /// Initializes a new instance of .
/// A unique identifier for the connection.
/// The name of the resource.
///
/// The properties of the resource
- /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
- /// The available derived classes include and .
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , , and .
///
/// Keeps track of any properties unknown to the library.
- internal ConnectionResponse(string id, string name, ConnectionProperties properties, IDictionary serializedAdditionalRawData)
+ internal GetConnectionResponse(string id, string name, InternalConnectionProperties properties, IDictionary serializedAdditionalRawData)
{
Id = id;
Name = name;
@@ -82,8 +82,8 @@ internal ConnectionResponse(string id, string name, ConnectionProperties propert
_serializedAdditionalRawData = serializedAdditionalRawData;
}
- /// Initializes a new instance of for deserialization.
- internal ConnectionResponse()
+ /// Initializes a new instance of for deserialization.
+ internal GetConnectionResponse()
{
}
@@ -93,9 +93,9 @@ internal ConnectionResponse()
public string Name { get; }
///
/// The properties of the resource
- /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
- /// The available derived classes include and .
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , , and .
///
- public ConnectionProperties Properties { get; }
+ public InternalConnectionProperties Properties { get; }
}
}
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/GetConnectionWithSecretsRequest.Serialization.cs b/sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionWithSecretsRequest.Serialization.cs
similarity index 99%
rename from sdk/ai/Azure.AI.Projects/src/Generated/GetConnectionWithSecretsRequest.Serialization.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionWithSecretsRequest.Serialization.cs
index 5b7ae79b07e0..299197cb8dd0 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/GetConnectionWithSecretsRequest.Serialization.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionWithSecretsRequest.Serialization.cs
@@ -11,7 +11,7 @@
using System.Text.Json;
using Azure.Core;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
internal partial class GetConnectionWithSecretsRequest : IUtf8JsonSerializable, IJsonModel
{
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/GetConnectionWithSecretsRequest.cs b/sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionWithSecretsRequest.cs
similarity index 99%
rename from sdk/ai/Azure.AI.Projects/src/Generated/GetConnectionWithSecretsRequest.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionWithSecretsRequest.cs
index 24c528083985..6e81a3568864 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/GetConnectionWithSecretsRequest.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/GetConnectionWithSecretsRequest.cs
@@ -8,7 +8,7 @@
using System;
using System.Collections.Generic;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
/// The GetConnectionWithSecretsRequest.
internal partial class GetConnectionWithSecretsRequest
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/GetWorkspaceResponse.Serialization.cs b/sdk/ai/Azure.AI.Connections/src/Generated/GetWorkspaceResponse.Serialization.cs
similarity index 97%
rename from sdk/ai/Azure.AI.Projects/src/Generated/GetWorkspaceResponse.Serialization.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/GetWorkspaceResponse.Serialization.cs
index 475bf9c4e306..393deedb4530 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/GetWorkspaceResponse.Serialization.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/GetWorkspaceResponse.Serialization.cs
@@ -11,9 +11,9 @@
using System.Text.Json;
using Azure.Core;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
- public partial class GetWorkspaceResponse : IUtf8JsonSerializable, IJsonModel
+ internal partial class GetWorkspaceResponse : IUtf8JsonSerializable, IJsonModel
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/GetWorkspaceResponse.cs b/sdk/ai/Azure.AI.Connections/src/Generated/GetWorkspaceResponse.cs
similarity index 97%
rename from sdk/ai/Azure.AI.Projects/src/Generated/GetWorkspaceResponse.cs
rename to sdk/ai/Azure.AI.Connections/src/Generated/GetWorkspaceResponse.cs
index 856f903c20c9..542f30700165 100644
--- a/sdk/ai/Azure.AI.Projects/src/Generated/GetWorkspaceResponse.cs
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/GetWorkspaceResponse.cs
@@ -8,10 +8,10 @@
using System;
using System.Collections.Generic;
-namespace Azure.AI.Projects
+namespace Azure.AI.Connections
{
/// Response from the Workspace - Get operation.
- public partial class GetWorkspaceResponse
+ internal partial class GetWorkspaceResponse
{
///
/// Keeps track of any properties unknown to the library.
diff --git a/sdk/ai/Azure.AI.Connections/src/Generated/Internal/Argument.cs b/sdk/ai/Azure.AI.Connections/src/Generated/Internal/Argument.cs
new file mode 100644
index 000000000000..1c64a4250887
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/Internal/Argument.cs
@@ -0,0 +1,129 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace Azure.AI.Connections
+{
+ internal static class Argument
+ {
+ public static void AssertNotNull(T value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+
+ public static void AssertNotNull(T? value, string name)
+ where T : struct
+ {
+ if (!value.HasValue)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+
+ public static void AssertNotNullOrEmpty(IEnumerable value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value is ICollection collectionOfT && collectionOfT.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ if (value is ICollection collection && collection.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ using IEnumerator e = value.GetEnumerator();
+ if (!e.MoveNext())
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ }
+
+ public static void AssertNotNullOrEmpty(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value.Length == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty string.", name);
+ }
+ }
+
+ public static void AssertNotNullOrWhiteSpace(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name);
+ }
+ }
+
+ public static void AssertNotDefault(ref T value, string name)
+ where T : struct, IEquatable
+ {
+ if (value.Equals(default))
+ {
+ throw new ArgumentException("Value cannot be empty.", name);
+ }
+ }
+
+ public static void AssertInRange(T value, T minimum, T maximum, string name)
+ where T : notnull, IComparable
+ {
+ if (minimum.CompareTo(value) > 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed.");
+ }
+ if (maximum.CompareTo(value) < 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed.");
+ }
+ }
+
+ public static void AssertEnumDefined(Type enumType, object value, string name)
+ {
+ if (!Enum.IsDefined(enumType, value))
+ {
+ throw new ArgumentException($"Value not defined for {enumType.FullName}.", name);
+ }
+ }
+
+ public static T CheckNotNull(T value, string name)
+ where T : class
+ {
+ AssertNotNull(value, name);
+ return value;
+ }
+
+ public static string CheckNotNullOrEmpty(string value, string name)
+ {
+ AssertNotNullOrEmpty(value, name);
+ return value;
+ }
+
+ public static void AssertNull(T value, string name, string message = null)
+ {
+ if (value != null)
+ {
+ throw new ArgumentException(message ?? "Value must be null.", name);
+ }
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Connections/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/ai/Azure.AI.Connections/src/Generated/Internal/ModelSerializationExtensions.cs
new file mode 100644
index 000000000000..2d96d6a8a2d8
--- /dev/null
+++ b/sdk/ai/Azure.AI.Connections/src/Generated/Internal/ModelSerializationExtensions.cs
@@ -0,0 +1,398 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.Text.Json;
+using System.Xml;
+using Azure.Core;
+
+namespace Azure.AI.Connections
+{
+ internal static class ModelSerializationExtensions
+ {
+ internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W");
+
+ public static object GetObject(this JsonElement element)
+ {
+ switch (element.ValueKind)
+ {
+ case JsonValueKind.String:
+ return element.GetString();
+ case JsonValueKind.Number:
+ if (element.TryGetInt32(out int intValue))
+ {
+ return intValue;
+ }
+ if (element.TryGetInt64(out long longValue))
+ {
+ return longValue;
+ }
+ return element.GetDouble();
+ case JsonValueKind.True:
+ return true;
+ case JsonValueKind.False:
+ return false;
+ case JsonValueKind.Undefined:
+ case JsonValueKind.Null:
+ return null;
+ case JsonValueKind.Object:
+ var dictionary = new Dictionary();
+ foreach (var jsonProperty in element.EnumerateObject())
+ {
+ dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject());
+ }
+ return dictionary;
+ case JsonValueKind.Array:
+ var list = new List