diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersCreateUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersCreateUpdateOperation.cs new file mode 100644 index 000000000000..bf0ddecd84b5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersCreateUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update only some properties, use PATCH. + public partial class CassandraClustersCreateUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraClustersCreateUpdateOperation for mocking. + protected CassandraClustersCreateUpdateOperation() + { + } + + internal CassandraClustersCreateUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraClustersCreateUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ClusterResource Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ClusterResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ClusterResource.DeserializeClusterResource(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ClusterResource.DeserializeClusterResource(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersDeleteOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersDeleteOperation.cs new file mode 100644 index 000000000000..b9a749fcece3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersDeleteOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Deletes a managed Cassandra cluster. + public partial class CassandraClustersDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraClustersDeleteOperation for mocking. + protected CassandraClustersDeleteOperation() + { + } + + internal CassandraClustersDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraClustersDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersFetchNodeStatusOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersFetchNodeStatusOperation.cs new file mode 100644 index 000000000000..5044866b7b0f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersFetchNodeStatusOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Request the status of all nodes in the cluster (as returned by 'nodetool status'). + public partial class CassandraClustersFetchNodeStatusOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraClustersFetchNodeStatusOperation for mocking. + protected CassandraClustersFetchNodeStatusOperation() + { + } + + internal CassandraClustersFetchNodeStatusOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraClustersFetchNodeStatusOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ClusterNodeStatus Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ClusterNodeStatus IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ClusterNodeStatus.DeserializeClusterNodeStatus(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ClusterNodeStatus.DeserializeClusterNodeStatus(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersOperations.cs new file mode 100644 index 000000000000..22f85eb6f41d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersOperations.cs @@ -0,0 +1,621 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The CassandraClusters service client. + public partial class CassandraClustersOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal CassandraClustersRestOperations RestClient { get; } + + /// Initializes a new instance of CassandraClustersOperations for mocking. + protected CassandraClustersOperations() + { + } + + /// Initializes a new instance of CassandraClustersOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal CassandraClustersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new CassandraClustersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get the properties of a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, clusterName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get the properties of a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, clusterName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get the properties of an individual backup of this cluster that is available to restore. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + public virtual async Task> GetBackupAsync(string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.GetBackup"); + scope.Start(); + try + { + return await RestClient.GetBackupAsync(resourceGroupName, clusterName, backupId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get the properties of an individual backup of this cluster that is available to restore. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + public virtual Response GetBackup(string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.GetBackup"); + scope.Start(); + try + { + return RestClient.GetBackup(resourceGroupName, clusterName, backupId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all managed Cassandra clusters in this subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListBySubscriptionAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.ListBySubscription"); + scope.Start(); + try + { + var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// List all managed Cassandra clusters in this subscription. + /// The cancellation token to use. + public virtual Pageable ListBySubscription(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.ListBySubscription"); + scope.Start(); + try + { + var response = RestClient.ListBySubscription(cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// List all managed Cassandra clusters in this resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.ListByResourceGroup"); + scope.Start(); + try + { + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// List all managed Cassandra clusters in this resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.ListByResourceGroup"); + scope.Start(); + try + { + var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// List the backups of this cluster that are available to restore. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListBackupsAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.ListBackups"); + scope.Start(); + try + { + var response = await RestClient.ListBackupsAsync(resourceGroupName, clusterName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// List the backups of this cluster that are available to restore. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListBackups(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.ListBackups"); + scope.Start(); + try + { + var response = RestClient.ListBackups(resourceGroupName, clusterName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Deletes a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, clusterName, cancellationToken).ConfigureAwait(false); + return new CassandraClustersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, clusterName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public virtual CassandraClustersDeleteOperation StartDelete(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, clusterName, cancellationToken); + return new CassandraClustersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, clusterName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update only some properties, use PATCH. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The properties specifying the desired state of the managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartCreateUpdateAsync(string resourceGroupName, string clusterName, ClusterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartCreateUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateAsync(resourceGroupName, clusterName, body, cancellationToken).ConfigureAwait(false); + return new CassandraClustersCreateUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateRequest(resourceGroupName, clusterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update only some properties, use PATCH. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The properties specifying the desired state of the managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public virtual CassandraClustersCreateUpdateOperation StartCreateUpdate(string resourceGroupName, string clusterName, ClusterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartCreateUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdate(resourceGroupName, clusterName, body, cancellationToken); + return new CassandraClustersCreateUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateRequest(resourceGroupName, clusterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates some of the properties of a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Parameters to provide for specifying the managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartUpdateAsync(string resourceGroupName, string clusterName, ClusterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateAsync(resourceGroupName, clusterName, body, cancellationToken).ConfigureAwait(false); + return new CassandraClustersUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, clusterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates some of the properties of a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Parameters to provide for specifying the managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public virtual CassandraClustersUpdateOperation StartUpdate(string resourceGroupName, string clusterName, ClusterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.Update(resourceGroupName, clusterName, body, cancellationToken); + return new CassandraClustersUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, clusterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Request that repair begin on this cluster as soon as possible. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Specification of what keyspaces and tables to run repair on. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartRequestRepairAsync(string resourceGroupName, string clusterName, RepairPostBody body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartRequestRepair"); + scope.Start(); + try + { + var originalResponse = await RestClient.RequestRepairAsync(resourceGroupName, clusterName, body, cancellationToken).ConfigureAwait(false); + return new CassandraClustersRequestRepairOperation(_clientDiagnostics, _pipeline, RestClient.CreateRequestRepairRequest(resourceGroupName, clusterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Request that repair begin on this cluster as soon as possible. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Specification of what keyspaces and tables to run repair on. + /// The cancellation token to use. + /// , , or is null. + public virtual CassandraClustersRequestRepairOperation StartRequestRepair(string resourceGroupName, string clusterName, RepairPostBody body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartRequestRepair"); + scope.Start(); + try + { + var originalResponse = RestClient.RequestRepair(resourceGroupName, clusterName, body, cancellationToken); + return new CassandraClustersRequestRepairOperation(_clientDiagnostics, _pipeline, RestClient.CreateRequestRepairRequest(resourceGroupName, clusterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Request the status of all nodes in the cluster (as returned by 'nodetool status'). + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartFetchNodeStatusAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartFetchNodeStatus"); + scope.Start(); + try + { + var originalResponse = await RestClient.FetchNodeStatusAsync(resourceGroupName, clusterName, cancellationToken).ConfigureAwait(false); + return new CassandraClustersFetchNodeStatusOperation(_clientDiagnostics, _pipeline, RestClient.CreateFetchNodeStatusRequest(resourceGroupName, clusterName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Request the status of all nodes in the cluster (as returned by 'nodetool status'). + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public virtual CassandraClustersFetchNodeStatusOperation StartFetchNodeStatus(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraClustersOperations.StartFetchNodeStatus"); + scope.Start(); + try + { + var originalResponse = RestClient.FetchNodeStatus(resourceGroupName, clusterName, cancellationToken); + return new CassandraClustersFetchNodeStatusOperation(_clientDiagnostics, _pipeline, RestClient.CreateFetchNodeStatusRequest(resourceGroupName, clusterName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersRequestRepairOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersRequestRepairOperation.cs new file mode 100644 index 000000000000..d6fb831402ff --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersRequestRepairOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Request that repair begin on this cluster as soon as possible. + public partial class CassandraClustersRequestRepairOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraClustersRequestRepairOperation for mocking. + protected CassandraClustersRequestRepairOperation() + { + } + + internal CassandraClustersRequestRepairOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraClustersRequestRepairOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersRestOperations.cs new file mode 100644 index 000000000000..9fc1cad67b22 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersRestOperations.cs @@ -0,0 +1,860 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class CassandraClustersRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of CassandraClustersRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public CassandraClustersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListBySubscriptionRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List all managed Cassandra clusters in this subscription. + /// The cancellation token to use. + public async Task> ListBySubscriptionAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListBySubscriptionRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ListClusters value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ListClusters.DeserializeListClusters(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List all managed Cassandra clusters in this subscription. + /// The cancellation token to use. + public Response ListBySubscription(CancellationToken cancellationToken = default) + { + using var message = CreateListBySubscriptionRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ListClusters value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ListClusters.DeserializeListClusters(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List all managed Cassandra clusters in this resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + public async Task> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ListClusters value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ListClusters.DeserializeListClusters(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List all managed Cassandra clusters in this resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateListByResourceGroupRequest(resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ListClusters value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ListClusters.DeserializeListClusters(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get the properties of a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetRequest(resourceGroupName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClusterResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClusterResource.DeserializeClusterResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get the properties of a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public Response Get(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetRequest(resourceGroupName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClusterResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClusterResource.DeserializeClusterResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Deletes a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public async Task DeleteAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public Response Delete(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateRequest(string resourceGroupName, string clusterName, ClusterResource body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body); + request.Content = content; + return message; + } + + /// Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update only some properties, use PATCH. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The properties specifying the desired state of the managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public async Task CreateUpdateAsync(string resourceGroupName, string clusterName, ClusterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateCreateUpdateRequest(resourceGroupName, clusterName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update only some properties, use PATCH. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The properties specifying the desired state of the managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public Response CreateUpdate(string resourceGroupName, string clusterName, ClusterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateCreateUpdateRequest(resourceGroupName, clusterName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string clusterName, ClusterResource body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body); + request.Content = content; + return message; + } + + /// Updates some of the properties of a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Parameters to provide for specifying the managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public async Task UpdateAsync(string resourceGroupName, string clusterName, ClusterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateUpdateRequest(resourceGroupName, clusterName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates some of the properties of a managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Parameters to provide for specifying the managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public Response Update(string resourceGroupName, string clusterName, ClusterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateUpdateRequest(resourceGroupName, clusterName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRequestRepairRequest(string resourceGroupName, string clusterName, RepairPostBody body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/repair", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body); + request.Content = content; + return message; + } + + /// Request that repair begin on this cluster as soon as possible. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Specification of what keyspaces and tables to run repair on. + /// The cancellation token to use. + /// , , or is null. + public async Task RequestRepairAsync(string resourceGroupName, string clusterName, RepairPostBody body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateRequestRepairRequest(resourceGroupName, clusterName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Request that repair begin on this cluster as soon as possible. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Specification of what keyspaces and tables to run repair on. + /// The cancellation token to use. + /// , , or is null. + public Response RequestRepair(string resourceGroupName, string clusterName, RepairPostBody body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateRequestRepairRequest(resourceGroupName, clusterName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateFetchNodeStatusRequest(string resourceGroupName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/fetchNodeStatus", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Request the status of all nodes in the cluster (as returned by 'nodetool status'). + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public async Task FetchNodeStatusAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateFetchNodeStatusRequest(resourceGroupName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Request the status of all nodes in the cluster (as returned by 'nodetool status'). + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public Response FetchNodeStatus(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateFetchNodeStatusRequest(resourceGroupName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBackupsRequest(string resourceGroupName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/backups", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List the backups of this cluster that are available to restore. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public async Task> ListBackupsAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateListBackupsRequest(resourceGroupName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ListBackups value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Models.ListBackups.DeserializeListBackups(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List the backups of this cluster that are available to restore. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public Response ListBackups(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateListBackupsRequest(resourceGroupName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ListBackups value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Models.ListBackups.DeserializeListBackups(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetBackupRequest(string resourceGroupName, string clusterName, string backupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/backups/", false); + uri.AppendPath(backupId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get the properties of an individual backup of this cluster that is available to restore. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetBackupAsync(string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (backupId == null) + { + throw new ArgumentNullException(nameof(backupId)); + } + + using var message = CreateGetBackupRequest(resourceGroupName, clusterName, backupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BackupResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BackupResource.DeserializeBackupResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get the properties of an individual backup of this cluster that is available to restore. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public Response GetBackup(string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (backupId == null) + { + throw new ArgumentNullException(nameof(backupId)); + } + + using var message = CreateGetBackupRequest(resourceGroupName, clusterName, backupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BackupResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BackupResource.DeserializeBackupResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersUpdateOperation.cs new file mode 100644 index 000000000000..2dd6c1a762b4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClustersUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Updates some of the properties of a managed Cassandra cluster. + public partial class CassandraClustersUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraClustersUpdateOperation for mocking. + protected CassandraClustersUpdateOperation() + { + } + + internal CassandraClustersUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraClustersUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ClusterResource Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ClusterResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ClusterResource.DeserializeClusterResource(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ClusterResource.DeserializeClusterResource(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersCreateUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersCreateUpdateOperation.cs new file mode 100644 index 000000000000..25a9bef02786 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersCreateUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some properties, use PATCH. + public partial class CassandraDataCentersCreateUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraDataCentersCreateUpdateOperation for mocking. + protected CassandraDataCentersCreateUpdateOperation() + { + } + + internal CassandraDataCentersCreateUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraDataCentersCreateUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DataCenterResource Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + DataCenterResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return DataCenterResource.DeserializeDataCenterResource(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return DataCenterResource.DeserializeDataCenterResource(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersDeleteOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersDeleteOperation.cs new file mode 100644 index 000000000000..dda1bbd3faa4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersDeleteOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Delete a managed Cassandra data center. + public partial class CassandraDataCentersDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraDataCentersDeleteOperation for mocking. + protected CassandraDataCentersDeleteOperation() + { + } + + internal CassandraDataCentersDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraDataCentersDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersOperations.cs new file mode 100644 index 000000000000..2cf221b7c19a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersOperations.cs @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The CassandraDataCenters service client. + public partial class CassandraDataCentersOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal CassandraDataCentersRestOperations RestClient { get; } + + /// Initializes a new instance of CassandraDataCentersOperations for mocking. + protected CassandraDataCentersOperations() + { + } + + /// Initializes a new instance of CassandraDataCentersOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal CassandraDataCentersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new CassandraDataCentersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get the properties of a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string clusterName, string dataCenterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, clusterName, dataCenterName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get the properties of a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string clusterName, string dataCenterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, clusterName, dataCenterName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all data centers in a particular managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(resourceGroupName, clusterName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// List all data centers in a particular managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable List(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(resourceGroupName, clusterName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Delete a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string clusterName, string dataCenterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, clusterName, dataCenterName, cancellationToken).ConfigureAwait(false); + return new CassandraDataCentersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, clusterName, dataCenterName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public virtual CassandraDataCentersDeleteOperation StartDelete(string resourceGroupName, string clusterName, string dataCenterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, clusterName, dataCenterName, cancellationToken); + return new CassandraDataCentersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, clusterName, dataCenterName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some properties, use PATCH. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// Parameters specifying the managed Cassandra data center. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateAsync(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.StartCreateUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateAsync(resourceGroupName, clusterName, dataCenterName, body, cancellationToken).ConfigureAwait(false); + return new CassandraDataCentersCreateUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateRequest(resourceGroupName, clusterName, dataCenterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some properties, use PATCH. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// Parameters specifying the managed Cassandra data center. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraDataCentersCreateUpdateOperation StartCreateUpdate(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.StartCreateUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdate(resourceGroupName, clusterName, dataCenterName, body, cancellationToken); + return new CassandraDataCentersCreateUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateRequest(resourceGroupName, clusterName, dataCenterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update some of the properties of a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// Parameters to provide for specifying the managed Cassandra data center. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartUpdateAsync(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.StartUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateAsync(resourceGroupName, clusterName, dataCenterName, body, cancellationToken).ConfigureAwait(false); + return new CassandraDataCentersUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, clusterName, dataCenterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update some of the properties of a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// Parameters to provide for specifying the managed Cassandra data center. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraDataCentersUpdateOperation StartUpdate(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraDataCentersOperations.StartUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.Update(resourceGroupName, clusterName, dataCenterName, body, cancellationToken); + return new CassandraDataCentersUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, clusterName, dataCenterName, body).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersRestOperations.cs new file mode 100644 index 000000000000..8514523cf09b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersRestOperations.cs @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class CassandraDataCentersRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of CassandraDataCentersRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public CassandraDataCentersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest(string resourceGroupName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/dataCenters", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List all data centers in a particular managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public async Task> ListAsync(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateListRequest(resourceGroupName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ListDataCenters value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ListDataCenters.DeserializeListDataCenters(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List all data centers in a particular managed Cassandra cluster. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// or is null. + public Response List(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateListRequest(resourceGroupName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ListDataCenters value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ListDataCenters.DeserializeListDataCenters(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string clusterName, string dataCenterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/dataCenters/", false); + uri.AppendPath(dataCenterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get the properties of a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string clusterName, string dataCenterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + + using var message = CreateGetRequest(resourceGroupName, clusterName, dataCenterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataCenterResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataCenterResource.DeserializeDataCenterResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get the properties of a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string clusterName, string dataCenterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + + using var message = CreateGetRequest(resourceGroupName, clusterName, dataCenterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataCenterResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataCenterResource.DeserializeDataCenterResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string clusterName, string dataCenterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/dataCenters/", false); + uri.AppendPath(dataCenterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Delete a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string clusterName, string dataCenterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, clusterName, dataCenterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string clusterName, string dataCenterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, clusterName, dataCenterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateRequest(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/dataCenters/", false); + uri.AppendPath(dataCenterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body); + request.Content = content; + return message; + } + + /// Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some properties, use PATCH. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// Parameters specifying the managed Cassandra data center. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateAsync(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateCreateUpdateRequest(resourceGroupName, clusterName, dataCenterName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some properties, use PATCH. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// Parameters specifying the managed Cassandra data center. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdate(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateCreateUpdateRequest(resourceGroupName, clusterName, dataCenterName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/cassandraClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/dataCenters/", false); + uri.AppendPath(dataCenterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body); + request.Content = content; + return message; + } + + /// Update some of the properties of a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// Parameters to provide for specifying the managed Cassandra data center. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateAsync(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateUpdateRequest(resourceGroupName, clusterName, dataCenterName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update some of the properties of a managed Cassandra data center. + /// The name of the resource group. The name is case insensitive. + /// Managed Cassandra cluster name. + /// Data center name in a managed Cassandra cluster. + /// Parameters to provide for specifying the managed Cassandra data center. + /// The cancellation token to use. + /// , , , or is null. + public Response Update(string resourceGroupName, string clusterName, string dataCenterName, DataCenterResource body, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (dataCenterName == null) + { + throw new ArgumentNullException(nameof(dataCenterName)); + } + if (body == null) + { + throw new ArgumentNullException(nameof(body)); + } + + using var message = CreateUpdateRequest(resourceGroupName, clusterName, dataCenterName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersUpdateOperation.cs new file mode 100644 index 000000000000..876a97ffb120 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCentersUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update some of the properties of a managed Cassandra data center. + public partial class CassandraDataCentersUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraDataCentersUpdateOperation for mocking. + protected CassandraDataCentersUpdateOperation() + { + } + + internal CassandraDataCentersUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraDataCentersUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DataCenterResource Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + DataCenterResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return DataCenterResource.DeserializeDataCenterResource(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return DataCenterResource.DeserializeDataCenterResource(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraViewOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraViewOperation.cs new file mode 100644 index 000000000000..93ce14bfdd82 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesCreateUpdateCassandraViewOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB Cassandra View. + public partial class CassandraResourcesCreateUpdateCassandraViewOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraResourcesCreateUpdateCassandraViewOperation for mocking. + protected CassandraResourcesCreateUpdateCassandraViewOperation() + { + } + + internal CassandraResourcesCreateUpdateCassandraViewOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesCreateUpdateCassandraViewOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override CassandraViewGetResults Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + CassandraViewGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return CassandraViewGetResults.DeserializeCassandraViewGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return CassandraViewGetResults.DeserializeCassandraViewGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraViewOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraViewOperation.cs new file mode 100644 index 000000000000..12decf461f63 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesDeleteCassandraViewOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB Cassandra view. + public partial class CassandraResourcesDeleteCassandraViewOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraResourcesDeleteCassandraViewOperation for mocking. + protected CassandraResourcesDeleteCassandraViewOperation() + { + } + + internal CassandraResourcesDeleteCassandraViewOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesDeleteCassandraViewOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraViewToAutoscaleOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraViewToAutoscaleOperation.cs new file mode 100644 index 000000000000..a471c3abbdc3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraViewToAutoscaleOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. + public partial class CassandraResourcesMigrateCassandraViewToAutoscaleOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraResourcesMigrateCassandraViewToAutoscaleOperation for mocking. + protected CassandraResourcesMigrateCassandraViewToAutoscaleOperation() + { + } + + internal CassandraResourcesMigrateCassandraViewToAutoscaleOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesMigrateCassandraViewToAutoscaleOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraViewToManualThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraViewToManualThroughputOperation.cs new file mode 100644 index 000000000000..ce32f47e8ffe --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesMigrateCassandraViewToManualThroughputOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. + public partial class CassandraResourcesMigrateCassandraViewToManualThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraResourcesMigrateCassandraViewToManualThroughputOperation for mocking. + protected CassandraResourcesMigrateCassandraViewToManualThroughputOperation() + { + } + + internal CassandraResourcesMigrateCassandraViewToManualThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesMigrateCassandraViewToManualThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesOperations.cs index 8d3bff87cefc..12c57aecebf9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesOperations.cs @@ -32,9 +32,10 @@ protected CassandraResourcesOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal CassandraResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal CassandraResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new CassandraResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new CassandraResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -203,6 +204,90 @@ public virtual Response GetCassandraTableThroughpu } } + /// Gets the Cassandra view under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + public virtual async Task> GetCassandraViewAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraView"); + scope.Start(); + try + { + return await RestClient.GetCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Cassandra view under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + public virtual Response GetCassandraView(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraView"); + scope.Start(); + try + { + return RestClient.GetCassandraView(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + public virtual async Task> GetCassandraViewThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraViewThroughput"); + scope.Start(); + try + { + return await RestClient.GetCassandraViewThroughputAsync(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + public virtual Response GetCassandraViewThroughput(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.GetCassandraViewThroughput"); + scope.Start(); + try + { + return RestClient.GetCassandraViewThroughput(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. /// The name of the resource group. The name is case insensitive. /// Cosmos DB database account name. @@ -349,6 +434,84 @@ Page FirstPageFunc(int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, null); } + /// Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListCassandraViewsAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.ListCassandraViews"); + scope.Start(); + try + { + var response = await RestClient.ListCassandraViewsAsync(resourceGroupName, accountName, keyspaceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListCassandraViews(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.ListCassandraViews"); + scope.Start(); + try + { + var response = RestClient.ListCassandraViews(resourceGroupName, accountName, keyspaceName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + /// Create or update an Azure Cosmos DB Cassandra keyspace. /// The name of the resource group. The name is case insensitive. /// Cosmos DB database account name. @@ -1138,5 +1301,425 @@ public virtual CassandraResourcesMigrateCassandraTableToManualThroughputOperatio throw; } } + + /// Create or update an Azure Cosmos DB Cassandra View. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The parameters to provide for the current Cassandra View. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartCreateUpdateCassandraViewAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + if (createUpdateCassandraViewParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraViewParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartCreateUpdateCassandraView"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesCreateUpdateCassandraViewOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Cassandra View. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The parameters to provide for the current Cassandra View. + /// The cancellation token to use. + /// , , , , or is null. + public virtual CassandraResourcesCreateUpdateCassandraViewOperation StartCreateUpdateCassandraView(string resourceGroupName, string accountName, string keyspaceName, string viewName, CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + if (createUpdateCassandraViewParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraViewParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartCreateUpdateCassandraView"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateCassandraView(resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, cancellationToken); + return new CassandraResourcesCreateUpdateCassandraViewOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Cassandra view. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartDeleteCassandraViewAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartDeleteCassandraView"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteCassandraViewAsync(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesDeleteCassandraViewOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Cassandra view. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraResourcesDeleteCassandraViewOperation StartDeleteCassandraView(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartDeleteCassandraView"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteCassandraView(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken); + return new CassandraResourcesDeleteCassandraViewOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra view. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The RUs per second of the parameters to provide for the current Cassandra view. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartUpdateCassandraViewThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartUpdateCassandraViewThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateCassandraViewThroughputAsync(resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesUpdateCassandraViewThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateCassandraViewThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra view. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The RUs per second of the parameters to provide for the current Cassandra view. + /// The cancellation token to use. + /// , , , , or is null. + public virtual CassandraResourcesUpdateCassandraViewThroughputOperation StartUpdateCassandraViewThroughput(string resourceGroupName, string accountName, string keyspaceName, string viewName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartUpdateCassandraViewThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateCassandraViewThroughput(resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, cancellationToken); + return new CassandraResourcesUpdateCassandraViewThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateCassandraViewThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateCassandraViewToAutoscaleAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraViewToAutoscale"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateCassandraViewToAutoscaleAsync(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesMigrateCassandraViewToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraViewToAutoscaleRequest(resourceGroupName, accountName, keyspaceName, viewName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraResourcesMigrateCassandraViewToAutoscaleOperation StartMigrateCassandraViewToAutoscale(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraViewToAutoscale"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateCassandraViewToAutoscale(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken); + return new CassandraResourcesMigrateCassandraViewToAutoscaleOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraViewToAutoscaleRequest(resourceGroupName, accountName, keyspaceName, viewName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartMigrateCassandraViewToManualThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraViewToManualThroughput"); + scope.Start(); + try + { + var originalResponse = await RestClient.MigrateCassandraViewToManualThroughputAsync(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken).ConfigureAwait(false); + return new CassandraResourcesMigrateCassandraViewToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraViewToManualThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public virtual CassandraResourcesMigrateCassandraViewToManualThroughputOperation StartMigrateCassandraViewToManualThroughput(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var scope = _clientDiagnostics.CreateScope("CassandraResourcesOperations.StartMigrateCassandraViewToManualThroughput"); + scope.Start(); + try + { + var originalResponse = RestClient.MigrateCassandraViewToManualThroughput(resourceGroupName, accountName, keyspaceName, viewName, cancellationToken); + return new CassandraResourcesMigrateCassandraViewToManualThroughputOperation(_clientDiagnostics, _pipeline, RestClient.CreateMigrateCassandraViewToManualThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesRestOperations.cs index 65affea08a53..439fa045497a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesRestOperations.cs @@ -20,6 +20,7 @@ internal partial class CassandraResourcesRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class CassandraResourcesRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public CassandraResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public CassandraResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListCassandraKeyspacesRequest(string resourceGroupNam uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/cassandraKeyspaces", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +149,7 @@ internal HttpMessage CreateGetCassandraKeyspaceRequest(string resourceGroupName, uri.AppendPath(accountName, true); uri.AppendPath("/cassandraKeyspaces/", false); uri.AppendPath(keyspaceName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -237,7 +244,7 @@ internal HttpMessage CreateCreateUpdateCassandraKeyspaceRequest(string resourceG uri.AppendPath(accountName, true); uri.AppendPath("/cassandraKeyspaces/", false); uri.AppendPath(keyspaceName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -338,7 +345,7 @@ internal HttpMessage CreateDeleteCassandraKeyspaceRequest(string resourceGroupNa uri.AppendPath(accountName, true); uri.AppendPath("/cassandraKeyspaces/", false); uri.AppendPath(keyspaceName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -425,7 +432,7 @@ internal HttpMessage CreateGetCassandraKeyspaceThroughputRequest(string resource uri.AppendPath("/cassandraKeyspaces/", false); uri.AppendPath(keyspaceName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -521,7 +528,7 @@ internal HttpMessage CreateUpdateCassandraKeyspaceThroughputRequest(string resou uri.AppendPath("/cassandraKeyspaces/", false); uri.AppendPath(keyspaceName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -623,7 +630,7 @@ internal HttpMessage CreateMigrateCassandraKeyspaceToAutoscaleRequest(string res uri.AppendPath("/cassandraKeyspaces/", false); uri.AppendPath(keyspaceName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -711,7 +718,7 @@ internal HttpMessage CreateMigrateCassandraKeyspaceToManualThroughputRequest(str uri.AppendPath("/cassandraKeyspaces/", false); uri.AppendPath(keyspaceName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -799,7 +806,7 @@ internal HttpMessage CreateListCassandraTablesRequest(string resourceGroupName, uri.AppendPath("/cassandraKeyspaces/", false); uri.AppendPath(keyspaceName, true); uri.AppendPath("/tables", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -896,7 +903,7 @@ internal HttpMessage CreateGetCassandraTableRequest(string resourceGroupName, st uri.AppendPath(keyspaceName, true); uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1003,7 +1010,7 @@ internal HttpMessage CreateCreateUpdateCassandraTableRequest(string resourceGrou uri.AppendPath(keyspaceName, true); uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1116,7 +1123,7 @@ internal HttpMessage CreateDeleteCassandraTableRequest(string resourceGroupName, uri.AppendPath(keyspaceName, true); uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -1215,7 +1222,7 @@ internal HttpMessage CreateGetCassandraTableThroughputRequest(string resourceGro uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1323,7 +1330,7 @@ internal HttpMessage CreateUpdateCassandraTableThroughputRequest(string resource uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1437,7 +1444,7 @@ internal HttpMessage CreateMigrateCassandraTableToAutoscaleRequest(string resour uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1537,7 +1544,7 @@ internal HttpMessage CreateMigrateCassandraTableToManualThroughputRequest(string uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1618,5 +1625,843 @@ public Response MigrateCassandraTableToManualThroughput(string resourceGroupName throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } + + internal HttpMessage CreateListCassandraViewsRequest(string resourceGroupName, string accountName, string keyspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/views", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListCassandraViewsAsync(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateListCassandraViewsRequest(resourceGroupName, accountName, keyspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CassandraViewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CassandraViewListResult.DeserializeCassandraViewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// The cancellation token to use. + /// , , or is null. + public Response ListCassandraViews(string resourceGroupName, string accountName, string keyspaceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + + using var message = CreateListCassandraViewsRequest(resourceGroupName, accountName, keyspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CassandraViewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CassandraViewListResult.DeserializeCassandraViewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetCassandraViewRequest(string resourceGroupName, string accountName, string keyspaceName, string viewName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/views/", false); + uri.AppendPath(viewName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the Cassandra view under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetCassandraViewAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateGetCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CassandraViewGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CassandraViewGetResults.DeserializeCassandraViewGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the Cassandra view under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetCassandraView(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateGetCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CassandraViewGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CassandraViewGetResults.DeserializeCassandraViewGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateCassandraViewRequest(string resourceGroupName, string accountName, string keyspaceName, string viewName, CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/views/", false); + uri.AppendPath(viewName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateCassandraViewParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB Cassandra View. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The parameters to provide for the current Cassandra View. + /// The cancellation token to use. + /// , , , , or is null. + public async Task CreateUpdateCassandraViewAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + if (createUpdateCassandraViewParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraViewParameters)); + } + + using var message = CreateCreateUpdateCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB Cassandra View. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The parameters to provide for the current Cassandra View. + /// The cancellation token to use. + /// , , , , or is null. + public Response CreateUpdateCassandraView(string resourceGroupName, string accountName, string keyspaceName, string viewName, CassandraViewCreateUpdateParameters createUpdateCassandraViewParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + if (createUpdateCassandraViewParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateCassandraViewParameters)); + } + + using var message = CreateCreateUpdateCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteCassandraViewRequest(string resourceGroupName, string accountName, string keyspaceName, string viewName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/views/", false); + uri.AppendPath(viewName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB Cassandra view. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public async Task DeleteCassandraViewAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateDeleteCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes an existing Azure Cosmos DB Cassandra view. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public Response DeleteCassandraView(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateDeleteCassandraViewRequest(resourceGroupName, accountName, keyspaceName, viewName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetCassandraViewThroughputRequest(string resourceGroupName, string accountName, string keyspaceName, string viewName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/views/", false); + uri.AppendPath(viewName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetCassandraViewThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateGetCassandraViewThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public Response GetCassandraViewThroughput(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateGetCassandraViewThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ThroughputSettingsGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateCassandraViewThroughputRequest(string resourceGroupName, string accountName, string keyspaceName, string viewName, ThroughputSettingsUpdateParameters updateThroughputParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/views/", false); + uri.AppendPath(viewName, true); + uri.AppendPath("/throughputSettings/default", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateThroughputParameters); + request.Content = content; + return message; + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra view. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The RUs per second of the parameters to provide for the current Cassandra view. + /// The cancellation token to use. + /// , , , , or is null. + public async Task UpdateCassandraViewThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateCassandraViewThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update RUs per second of an Azure Cosmos DB Cassandra view. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The RUs per second of the parameters to provide for the current Cassandra view. + /// The cancellation token to use. + /// , , , , or is null. + public Response UpdateCassandraViewThroughput(string resourceGroupName, string accountName, string keyspaceName, string viewName, ThroughputSettingsUpdateParameters updateThroughputParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + if (updateThroughputParameters == null) + { + throw new ArgumentNullException(nameof(updateThroughputParameters)); + } + + using var message = CreateUpdateCassandraViewThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateCassandraViewToAutoscaleRequest(string resourceGroupName, string accountName, string keyspaceName, string viewName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/views/", false); + uri.AppendPath(viewName, true); + uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateCassandraViewToAutoscaleAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateMigrateCassandraViewToAutoscaleRequest(resourceGroupName, accountName, keyspaceName, viewName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateCassandraViewToAutoscale(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateMigrateCassandraViewToAutoscaleRequest(resourceGroupName, accountName, keyspaceName, viewName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateMigrateCassandraViewToManualThroughputRequest(string resourceGroupName, string accountName, string keyspaceName, string viewName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/cassandraKeyspaces/", false); + uri.AppendPath(keyspaceName, true); + uri.AppendPath("/views/", false); + uri.AppendPath(viewName, true); + uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public async Task MigrateCassandraViewToManualThroughputAsync(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateMigrateCassandraViewToManualThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB keyspace name. + /// Cosmos DB view name. + /// The cancellation token to use. + /// , , , or is null. + public Response MigrateCassandraViewToManualThroughput(string resourceGroupName, string accountName, string keyspaceName, string viewName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (keyspaceName == null) + { + throw new ArgumentNullException(nameof(keyspaceName)); + } + if (viewName == null) + { + throw new ArgumentNullException(nameof(viewName)); + } + + using var message = CreateMigrateCassandraViewToManualThroughputRequest(resourceGroupName, accountName, keyspaceName, viewName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraViewThroughputOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraViewThroughputOperation.cs new file mode 100644 index 000000000000..df9e8d9bf500 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraResourcesUpdateCassandraViewThroughputOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Update RUs per second of an Azure Cosmos DB Cassandra view. + public partial class CassandraResourcesUpdateCassandraViewThroughputOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of CassandraResourcesUpdateCassandraViewThroughputOperation for mocking. + protected CassandraResourcesUpdateCassandraViewThroughputOperation() + { + } + + internal CassandraResourcesUpdateCassandraViewThroughputOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CassandraResourcesUpdateCassandraViewThroughputOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ThroughputSettingsGetResults Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ThroughputSettingsGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ThroughputSettingsGetResults.DeserializeThroughputSettingsGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionOperations.cs index 852c76cebd5a..24186466e659 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionOperations.cs @@ -32,9 +32,10 @@ protected CollectionOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal CollectionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal CollectionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new CollectionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new CollectionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionOperations.cs index 916163a39db5..1c5388df3da0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionOperations.cs @@ -32,9 +32,10 @@ protected CollectionPartitionOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal CollectionPartitionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal CollectionPartitionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new CollectionPartitionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new CollectionPartitionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionOperations.cs index 10e3190819f7..3b21fbb31e04 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionOperations.cs @@ -32,9 +32,10 @@ protected CollectionPartitionRegionOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal CollectionPartitionRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal CollectionPartitionRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new CollectionPartitionRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new CollectionPartitionRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionRestOperations.cs index 5fdd6957566d..952ff992e0b3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRegionRestOperations.cs @@ -20,6 +20,7 @@ internal partial class CollectionPartitionRegionRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class CollectionPartitionRegionRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public CollectionPartitionRegionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public CollectionPartitionRegionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -63,7 +70,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/collections/", false); uri.AppendPath(collectionRid, true); uri.AppendPath("/partitions/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRestOperations.cs index 366fb293e0d5..770ef170bf4f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionPartitionRestOperations.cs @@ -20,6 +20,7 @@ internal partial class CollectionPartitionRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class CollectionPartitionRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public CollectionPartitionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public CollectionPartitionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -61,7 +68,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/collections/", false); uri.AppendPath(collectionRid, true); uri.AppendPath("/partitions/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -180,7 +187,7 @@ internal HttpMessage CreateListUsagesRequest(string resourceGroupName, string ac uri.AppendPath("/collections/", false); uri.AppendPath(collectionRid, true); uri.AppendPath("/partitions/usages", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionOperations.cs index d913d7992cc6..55e80ecefadb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionOperations.cs @@ -32,9 +32,10 @@ protected CollectionRegionOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal CollectionRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal CollectionRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new CollectionRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new CollectionRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionRestOperations.cs index c7d5f05ffaf8..50ced1166bc4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRegionRestOperations.cs @@ -20,6 +20,7 @@ internal partial class CollectionRegionRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class CollectionRegionRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public CollectionRegionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public CollectionRegionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -63,7 +70,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/collections/", false); uri.AppendPath(collectionRid, true); uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRestOperations.cs index b72bb74763d1..69cde9dd7aa6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CollectionRestOperations.cs @@ -20,6 +20,7 @@ internal partial class CollectionRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class CollectionRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public CollectionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public CollectionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -61,7 +68,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/collections/", false); uri.AppendPath(collectionRid, true); uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -180,7 +187,7 @@ internal HttpMessage CreateListUsagesRequest(string resourceGroupName, string ac uri.AppendPath("/collections/", false); uri.AppendPath(collectionRid, true); uri.AppendPath("/usages", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); @@ -294,7 +301,7 @@ internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName uri.AppendPath("/collections/", false); uri.AppendPath(collectionRid, true); uri.AppendPath("/metricDefinitions", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClient.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClient.cs index af5d2ec3251d..72c042da9b76 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClient.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementClient.cs @@ -92,6 +92,9 @@ public CosmosDBManagementClient(string subscriptionId, Uri endpoint, TokenCreden /// Returns an instance of PartitionKeyRangeIdRegionOperations. public virtual PartitionKeyRangeIdRegionOperations PartitionKeyRangeIdRegion => new PartitionKeyRangeIdRegionOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of GraphResourcesOperations. + public virtual GraphResourcesOperations GraphResources => new GraphResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of SqlResourcesOperations. public virtual SqlResourcesOperations SqlResources => new SqlResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); @@ -107,13 +110,46 @@ public CosmosDBManagementClient(string subscriptionId, Uri endpoint, TokenCreden /// Returns an instance of GremlinResourcesOperations. public virtual GremlinResourcesOperations GremlinResources => new GremlinResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of CosmosDBManagementOperations. + public virtual CosmosDBManagementOperations CosmosDBManagement => new CosmosDBManagementOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of NotebookWorkspacesOperations. public virtual NotebookWorkspacesOperations NotebookWorkspaces => new NotebookWorkspacesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of PrivateEndpointConnectionsOperations. + public virtual PrivateEndpointConnectionsOperations PrivateEndpointConnections => new PrivateEndpointConnectionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of PrivateLinkResourcesOperations. public virtual PrivateLinkResourcesOperations PrivateLinkResources => new PrivateLinkResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of PrivateEndpointConnectionsOperations. - public virtual PrivateEndpointConnectionsOperations PrivateEndpointConnections => new PrivateEndpointConnectionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of RestorableDatabaseAccountsOperations. + public virtual RestorableDatabaseAccountsOperations RestorableDatabaseAccounts => new RestorableDatabaseAccountsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of RestorableSqlDatabasesOperations. + public virtual RestorableSqlDatabasesOperations RestorableSqlDatabases => new RestorableSqlDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of RestorableSqlContainersOperations. + public virtual RestorableSqlContainersOperations RestorableSqlContainers => new RestorableSqlContainersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of RestorableSqlResourcesOperations. + public virtual RestorableSqlResourcesOperations RestorableSqlResources => new RestorableSqlResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of RestorableMongodbDatabasesOperations. + public virtual RestorableMongodbDatabasesOperations RestorableMongodbDatabases => new RestorableMongodbDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of RestorableMongodbCollectionsOperations. + public virtual RestorableMongodbCollectionsOperations RestorableMongodbCollections => new RestorableMongodbCollectionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of RestorableMongodbResourcesOperations. + public virtual RestorableMongodbResourcesOperations RestorableMongodbResources => new RestorableMongodbResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of CassandraClustersOperations. + public virtual CassandraClustersOperations CassandraClusters => new CassandraClustersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of CassandraDataCentersOperations. + public virtual CassandraDataCentersOperations CassandraDataCenters => new CassandraDataCentersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServiceOperations. + public virtual ServiceOperations Service => new ServiceOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementOperations.cs new file mode 100644 index 000000000000..5460633991b7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementOperations.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The CosmosDBManagement service client. + public partial class CosmosDBManagementOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal CosmosDBManagementRestOperations RestClient { get; } + + /// Initializes a new instance of CosmosDBManagementOperations for mocking. + protected CosmosDBManagementOperations() + { + } + + /// Initializes a new instance of CosmosDBManagementOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal CosmosDBManagementOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new CosmosDBManagementRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get the properties of an existing Cosmos DB location. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + public virtual async Task> LocationGetAsync(string location, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CosmosDBManagementOperations.LocationGet"); + scope.Start(); + try + { + return await RestClient.LocationGetAsync(location, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get the properties of an existing Cosmos DB location. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + public virtual Response LocationGet(string location, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CosmosDBManagementOperations.LocationGet"); + scope.Start(); + try + { + return RestClient.LocationGet(location, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List Cosmos DB locations and their properties. + /// The cancellation token to use. + public virtual AsyncPageable LocationListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CosmosDBManagementOperations.LocationList"); + scope.Start(); + try + { + var response = await RestClient.LocationListAsync(cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// List Cosmos DB locations and their properties. + /// The cancellation token to use. + public virtual Pageable LocationList(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CosmosDBManagementOperations.LocationList"); + scope.Start(); + try + { + var response = RestClient.LocationList(cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementRestOperations.cs new file mode 100644 index 000000000000..5155539eba92 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBManagementRestOperations.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class CosmosDBManagementRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of CosmosDBManagementRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public CosmosDBManagementRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateLocationListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List Cosmos DB locations and their properties. + /// The cancellation token to use. + public async Task> LocationListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateLocationListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LocationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LocationListResult.DeserializeLocationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List Cosmos DB locations and their properties. + /// The cancellation token to use. + public Response LocationList(CancellationToken cancellationToken = default) + { + using var message = CreateLocationListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LocationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LocationListResult.DeserializeLocationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateLocationGetRequest(string location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get the properties of an existing Cosmos DB location. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + /// is null. + public async Task> LocationGetAsync(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateLocationGetRequest(location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LocationGetResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LocationGetResult.DeserializeLocationGetResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get the properties of an existing Cosmos DB location. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + /// is null. + public Response LocationGet(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateLocationGetRequest(location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LocationGetResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LocationGetResult.DeserializeLocationGetResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionOperations.cs index 44b309c59e0a..4c44e6be273c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionOperations.cs @@ -32,9 +32,10 @@ protected DatabaseAccountRegionOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal DatabaseAccountRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal DatabaseAccountRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new DatabaseAccountRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new DatabaseAccountRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionRestOperations.cs index 3cb832ca8215..9a83c7ca1942 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountRegionRestOperations.cs @@ -20,6 +20,7 @@ internal partial class DatabaseAccountRegionRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class DatabaseAccountRegionRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public DatabaseAccountRegionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public DatabaseAccountRegionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -59,7 +66,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/region/", false); uri.AppendPath(region, true); uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOperations.cs index 038b9b87d7de..7938b649f414 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsOperations.cs @@ -32,9 +32,10 @@ protected DatabaseAccountsOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal DatabaseAccountsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal DatabaseAccountsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new DatabaseAccountsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new DatabaseAccountsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRestOperations.cs index a6edc34e0c45..2f1160ef3977 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseAccountsRestOperations.cs @@ -20,6 +20,7 @@ internal partial class DatabaseAccountsRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class DatabaseAccountsRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public DatabaseAccountsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public DatabaseAccountsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -56,7 +63,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string accountNa uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -139,7 +146,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string accoun uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -226,7 +233,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -313,7 +320,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accoun uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -388,7 +395,7 @@ internal HttpMessage CreateFailoverPriorityChangeRequest(string resourceGroupNam uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/failoverPriorityChange", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -473,7 +480,7 @@ internal HttpMessage CreateListRequest() uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -531,7 +538,7 @@ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -605,7 +612,7 @@ internal HttpMessage CreateListKeysRequest(string resourceGroupName, string acco uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/listKeys", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -689,7 +696,7 @@ internal HttpMessage CreateListConnectionStringsRequest(string resourceGroupName uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/listConnectionStrings", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -773,7 +780,7 @@ internal HttpMessage CreateOfflineRegionRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/offlineRegion", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -863,7 +870,7 @@ internal HttpMessage CreateOnlineRegionRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/onlineRegion", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -953,7 +960,7 @@ internal HttpMessage CreateGetReadOnlyKeysRequest(string resourceGroupName, stri uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/readonlykeys", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1037,7 +1044,7 @@ internal HttpMessage CreateListReadOnlyKeysRequest(string resourceGroupName, str uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/readonlykeys", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1121,7 +1128,7 @@ internal HttpMessage CreateRegenerateKeyRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/regenerateKey", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -1205,7 +1212,7 @@ internal HttpMessage CreateCheckNameExistsRequest(string accountName) uri.Reset(endpoint); uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccountNames/", false); uri.AppendPath(accountName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -1284,7 +1291,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1379,7 +1386,7 @@ internal HttpMessage CreateListUsagesRequest(string resourceGroupName, string ac uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/usages", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); @@ -1469,7 +1476,7 @@ internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/metricDefinitions", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseOperations.cs index b903935f3b70..6896ec151354 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseOperations.cs @@ -32,9 +32,10 @@ protected DatabaseOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal DatabaseOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal DatabaseOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new DatabaseRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new DatabaseRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseRestOperations.cs index 555673f2c5d1..628185df7012 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DatabaseRestOperations.cs @@ -20,6 +20,7 @@ internal partial class DatabaseRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class DatabaseRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public DatabaseRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public DatabaseRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -59,7 +66,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/databases/", false); uri.AppendPath(databaseRid, true); uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -166,7 +173,7 @@ internal HttpMessage CreateListUsagesRequest(string resourceGroupName, string ac uri.AppendPath("/databases/", false); uri.AppendPath(databaseRid, true); uri.AppendPath("/usages", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); @@ -268,7 +275,7 @@ internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName uri.AppendPath("/databases/", false); uri.AppendPath(databaseRid, true); uri.AppendPath("/metricDefinitions", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesCreateUpdateGraphOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesCreateUpdateGraphOperation.cs new file mode 100644 index 000000000000..c890d10c4a6d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesCreateUpdateGraphOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Create or update an Azure Cosmos DB Graph. + public partial class GraphResourcesCreateUpdateGraphOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of GraphResourcesCreateUpdateGraphOperation for mocking. + protected GraphResourcesCreateUpdateGraphOperation() + { + } + + internal GraphResourcesCreateUpdateGraphOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GraphResourcesCreateUpdateGraphOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override GraphResourceGetResults Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + GraphResourceGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return GraphResourceGetResults.DeserializeGraphResourceGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return GraphResourceGetResults.DeserializeGraphResourceGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesDeleteGraphResourceOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesDeleteGraphResourceOperation.cs new file mode 100644 index 000000000000..1ac83ff295a1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesDeleteGraphResourceOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB Graph Resource. + public partial class GraphResourcesDeleteGraphResourceOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of GraphResourcesDeleteGraphResourceOperation for mocking. + protected GraphResourcesDeleteGraphResourceOperation() + { + } + + internal GraphResourcesDeleteGraphResourceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GraphResourcesDeleteGraphResourceOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesOperations.cs new file mode 100644 index 000000000000..d88d2909c484 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesOperations.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The GraphResources service client. + public partial class GraphResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal GraphResourcesRestOperations RestClient { get; } + + /// Initializes a new instance of GraphResourcesOperations for mocking. + protected GraphResourcesOperations() + { + } + + /// Initializes a new instance of GraphResourcesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal GraphResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new GraphResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the Graph resource under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The cancellation token to use. + public virtual async Task> GetGraphAsync(string resourceGroupName, string accountName, string graphName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GraphResourcesOperations.GetGraph"); + scope.Start(); + try + { + return await RestClient.GetGraphAsync(resourceGroupName, accountName, graphName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the Graph resource under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The cancellation token to use. + public virtual Response GetGraph(string resourceGroupName, string accountName, string graphName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GraphResourcesOperations.GetGraph"); + scope.Start(); + try + { + return RestClient.GetGraph(resourceGroupName, accountName, graphName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the graphs under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListGraphsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GraphResourcesOperations.ListGraphs"); + scope.Start(); + try + { + var response = await RestClient.ListGraphsAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists the graphs under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListGraphs(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GraphResourcesOperations.ListGraphs"); + scope.Start(); + try + { + var response = RestClient.ListGraphs(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Create or update an Azure Cosmos DB Graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The parameters to provide for the current graph. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateGraphAsync(string resourceGroupName, string accountName, string graphName, GraphResourceCreateUpdateParameters createUpdateGraphParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (createUpdateGraphParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGraphParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GraphResourcesOperations.StartCreateUpdateGraph"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateGraphAsync(resourceGroupName, accountName, graphName, createUpdateGraphParameters, cancellationToken).ConfigureAwait(false); + return new GraphResourcesCreateUpdateGraphOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateGraphRequest(resourceGroupName, accountName, graphName, createUpdateGraphParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an Azure Cosmos DB Graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The parameters to provide for the current graph. + /// The cancellation token to use. + /// , , , or is null. + public virtual GraphResourcesCreateUpdateGraphOperation StartCreateUpdateGraph(string resourceGroupName, string accountName, string graphName, GraphResourceCreateUpdateParameters createUpdateGraphParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (createUpdateGraphParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGraphParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("GraphResourcesOperations.StartCreateUpdateGraph"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateGraph(resourceGroupName, accountName, graphName, createUpdateGraphParameters, cancellationToken); + return new GraphResourcesCreateUpdateGraphOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateGraphRequest(resourceGroupName, accountName, graphName, createUpdateGraphParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Graph Resource. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteGraphResourceAsync(string resourceGroupName, string accountName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var scope = _clientDiagnostics.CreateScope("GraphResourcesOperations.StartDeleteGraphResource"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteGraphResourceAsync(resourceGroupName, accountName, graphName, cancellationToken).ConfigureAwait(false); + return new GraphResourcesDeleteGraphResourceOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteGraphResourceRequest(resourceGroupName, accountName, graphName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB Graph Resource. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The cancellation token to use. + /// , , or is null. + public virtual GraphResourcesDeleteGraphResourceOperation StartDeleteGraphResource(string resourceGroupName, string accountName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var scope = _clientDiagnostics.CreateScope("GraphResourcesOperations.StartDeleteGraphResource"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteGraphResource(resourceGroupName, accountName, graphName, cancellationToken); + return new GraphResourcesDeleteGraphResourceOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteGraphResourceRequest(resourceGroupName, accountName, graphName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesRestOperations.cs new file mode 100644 index 000000000000..38943509c239 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourcesRestOperations.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class GraphResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of GraphResourcesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public GraphResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListGraphsRequest(string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/graphs", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists the graphs under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListGraphsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListGraphsRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GraphResourcesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GraphResourcesListResult.DeserializeGraphResourcesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the graphs under an existing Azure Cosmos DB database account. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListGraphs(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListGraphsRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GraphResourcesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GraphResourcesListResult.DeserializeGraphResourcesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGraphRequest(string resourceGroupName, string accountName, string graphName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the Graph resource under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetGraphAsync(string resourceGroupName, string accountName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateGetGraphRequest(resourceGroupName, accountName, graphName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GraphResourceGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GraphResourceGetResults.DeserializeGraphResourceGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the Graph resource under an existing Azure Cosmos DB database account with the provided name. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The cancellation token to use. + /// , , or is null. + public Response GetGraph(string resourceGroupName, string accountName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateGetGraphRequest(resourceGroupName, accountName, graphName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GraphResourceGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GraphResourceGetResults.DeserializeGraphResourceGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateGraphRequest(string resourceGroupName, string accountName, string graphName, GraphResourceCreateUpdateParameters createUpdateGraphParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateGraphParameters); + request.Content = content; + return message; + } + + /// Create or update an Azure Cosmos DB Graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The parameters to provide for the current graph. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateGraphAsync(string resourceGroupName, string accountName, string graphName, GraphResourceCreateUpdateParameters createUpdateGraphParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (createUpdateGraphParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGraphParameters)); + } + + using var message = CreateCreateUpdateGraphRequest(resourceGroupName, accountName, graphName, createUpdateGraphParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an Azure Cosmos DB Graph. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The parameters to provide for the current graph. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdateGraph(string resourceGroupName, string accountName, string graphName, GraphResourceCreateUpdateParameters createUpdateGraphParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + if (createUpdateGraphParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateGraphParameters)); + } + + using var message = CreateCreateUpdateGraphRequest(resourceGroupName, accountName, graphName, createUpdateGraphParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteGraphResourceRequest(string resourceGroupName, string accountName, string graphName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/graphs/", false); + uri.AppendPath(graphName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + return message; + } + + /// Deletes an existing Azure Cosmos DB Graph Resource. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteGraphResourceAsync(string resourceGroupName, string accountName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateDeleteGraphResourceRequest(resourceGroupName, accountName, graphName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes an existing Azure Cosmos DB Graph Resource. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB graph resource name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteGraphResource(string resourceGroupName, string accountName, string graphName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (graphName == null) + { + throw new ArgumentNullException(nameof(graphName)); + } + + using var message = CreateDeleteGraphResourceRequest(resourceGroupName, accountName, graphName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesOperations.cs index 0e382d0ebe0c..4966d447fdf1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesOperations.cs @@ -32,9 +32,10 @@ protected GremlinResourcesOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal GremlinResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal GremlinResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new GremlinResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new GremlinResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesRestOperations.cs index 1ac354e16c05..d5198fa38301 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinResourcesRestOperations.cs @@ -20,6 +20,7 @@ internal partial class GremlinResourcesRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class GremlinResourcesRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public GremlinResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public GremlinResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListGremlinDatabasesRequest(string resourceGroupName, uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/gremlinDatabases", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +149,7 @@ internal HttpMessage CreateGetGremlinDatabaseRequest(string resourceGroupName, s uri.AppendPath(accountName, true); uri.AppendPath("/gremlinDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -237,7 +244,7 @@ internal HttpMessage CreateCreateUpdateGremlinDatabaseRequest(string resourceGro uri.AppendPath(accountName, true); uri.AppendPath("/gremlinDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -338,7 +345,7 @@ internal HttpMessage CreateDeleteGremlinDatabaseRequest(string resourceGroupName uri.AppendPath(accountName, true); uri.AppendPath("/gremlinDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -425,7 +432,7 @@ internal HttpMessage CreateGetGremlinDatabaseThroughputRequest(string resourceGr uri.AppendPath("/gremlinDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -521,7 +528,7 @@ internal HttpMessage CreateUpdateGremlinDatabaseThroughputRequest(string resourc uri.AppendPath("/gremlinDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -623,7 +630,7 @@ internal HttpMessage CreateMigrateGremlinDatabaseToAutoscaleRequest(string resou uri.AppendPath("/gremlinDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -711,7 +718,7 @@ internal HttpMessage CreateMigrateGremlinDatabaseToManualThroughputRequest(strin uri.AppendPath("/gremlinDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -799,7 +806,7 @@ internal HttpMessage CreateListGremlinGraphsRequest(string resourceGroupName, st uri.AppendPath("/gremlinDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/graphs", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -896,7 +903,7 @@ internal HttpMessage CreateGetGremlinGraphRequest(string resourceGroupName, stri uri.AppendPath(databaseName, true); uri.AppendPath("/graphs/", false); uri.AppendPath(graphName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1003,7 +1010,7 @@ internal HttpMessage CreateCreateUpdateGremlinGraphRequest(string resourceGroupN uri.AppendPath(databaseName, true); uri.AppendPath("/graphs/", false); uri.AppendPath(graphName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1116,7 +1123,7 @@ internal HttpMessage CreateDeleteGremlinGraphRequest(string resourceGroupName, s uri.AppendPath(databaseName, true); uri.AppendPath("/graphs/", false); uri.AppendPath(graphName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -1215,7 +1222,7 @@ internal HttpMessage CreateGetGremlinGraphThroughputRequest(string resourceGroup uri.AppendPath("/graphs/", false); uri.AppendPath(graphName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1323,7 +1330,7 @@ internal HttpMessage CreateUpdateGremlinGraphThroughputRequest(string resourceGr uri.AppendPath("/graphs/", false); uri.AppendPath(graphName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1437,7 +1444,7 @@ internal HttpMessage CreateMigrateGremlinGraphToAutoscaleRequest(string resource uri.AppendPath("/graphs/", false); uri.AppendPath(graphName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1537,7 +1544,7 @@ internal HttpMessage CreateMigrateGremlinGraphToManualThroughputRequest(string r uri.AppendPath("/graphs/", false); uri.AppendPath(graphName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.Serialization.cs index 7bb850b928ac..6c22da4046cc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WriteEndObject(); } @@ -42,6 +47,7 @@ internal static ARMResourceProperties DeserializeARMResourceProperties(JsonEleme Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -79,8 +85,18 @@ internal static ARMResourceProperties DeserializeARMResourceProperties(JsonEleme tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } } - return new ARMResourceProperties(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags)); + return new ARMResourceProperties(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.cs index d175530d42e3..ed3f29280458 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ARMResourceProperties.cs @@ -25,13 +25,15 @@ public ARMResourceProperties() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". - internal ARMResourceProperties(string id, string name, string type, string location, IDictionary tags) + /// Identity for the resource. + internal ARMResourceProperties(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity) { Id = id; Name = name; Type = type; Location = location; Tags = tags; + Identity = identity; } /// The unique resource identifier of the ARM resource. @@ -44,5 +46,7 @@ internal ARMResourceProperties(string id, string name, string type, string locat public string Location { get; set; } /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". public IDictionary Tags { get; } + /// Identity for the resource. + public ManagedServiceIdentity Identity { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.Serialization.cs new file mode 100644 index 000000000000..6c3efac0ffd1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.Serialization.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class AnalyticalStorageConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SchemaType)) + { + writer.WritePropertyName("schemaType"); + writer.WriteStringValue(SchemaType.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AnalyticalStorageConfiguration DeserializeAnalyticalStorageConfiguration(JsonElement element) + { + Optional schemaType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("schemaType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + schemaType = new AnalyticalStorageSchemaType(property.Value.GetString()); + continue; + } + } + return new AnalyticalStorageConfiguration(Optional.ToNullable(schemaType)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.cs new file mode 100644 index 000000000000..849b159fa6ee --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Analytical storage specific properties. + public partial class AnalyticalStorageConfiguration + { + /// Initializes a new instance of AnalyticalStorageConfiguration. + public AnalyticalStorageConfiguration() + { + } + + /// Initializes a new instance of AnalyticalStorageConfiguration. + /// Describes the types of schema for analytical storage. + internal AnalyticalStorageConfiguration(AnalyticalStorageSchemaType? schemaType) + { + SchemaType = schemaType; + } + + /// Describes the types of schema for analytical storage. + public AnalyticalStorageSchemaType? SchemaType { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageSchemaType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageSchemaType.cs new file mode 100644 index 000000000000..064913eb2230 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageSchemaType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the types of schema for analytical storage. + public readonly partial struct AnalyticalStorageSchemaType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public AnalyticalStorageSchemaType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string WellDefinedValue = "WellDefined"; + private const string FullFidelityValue = "FullFidelity"; + + /// WellDefined. + public static AnalyticalStorageSchemaType WellDefined { get; } = new AnalyticalStorageSchemaType(WellDefinedValue); + /// FullFidelity. + public static AnalyticalStorageSchemaType FullFidelity { get; } = new AnalyticalStorageSchemaType(FullFidelityValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyticalStorageSchemaType left, AnalyticalStorageSchemaType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyticalStorageSchemaType left, AnalyticalStorageSchemaType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyticalStorageSchemaType(string value) => new AnalyticalStorageSchemaType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyticalStorageSchemaType other && Equals(other); + /// + public bool Equals(AnalyticalStorageSchemaType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiType.cs new file mode 100644 index 000000000000..459df83fd36a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiType.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Enum to indicate the API type of the restorable database account. + public readonly partial struct ApiType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ApiType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MongoDBValue = "MongoDB"; + private const string GremlinValue = "Gremlin"; + private const string CassandraValue = "Cassandra"; + private const string TableValue = "Table"; + private const string SqlValue = "Sql"; + private const string GremlinV2Value = "GremlinV2"; + + /// MongoDB. + public static ApiType MongoDB { get; } = new ApiType(MongoDBValue); + /// Gremlin. + public static ApiType Gremlin { get; } = new ApiType(GremlinValue); + /// Cassandra. + public static ApiType Cassandra { get; } = new ApiType(CassandraValue); + /// Table. + public static ApiType Table { get; } = new ApiType(TableValue); + /// Sql. + public static ApiType Sql { get; } = new ApiType(SqlValue); + /// GremlinV2. + public static ApiType GremlinV2 { get; } = new ApiType(GremlinV2Value); + /// Determines if two values are the same. + public static bool operator ==(ApiType left, ApiType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ApiType left, ApiType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ApiType(string value) => new ApiType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ApiType other && Equals(other); + /// + public bool Equals(ApiType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethod.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethod.cs new file mode 100644 index 000000000000..15b4c7392ae0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethod.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password based authentication. The default is 'Cassandra'. + public readonly partial struct AuthenticationMethod : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public AuthenticationMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string CassandraValue = "Cassandra"; + + /// None. + public static AuthenticationMethod None { get; } = new AuthenticationMethod(NoneValue); + /// Cassandra. + public static AuthenticationMethod Cassandra { get; } = new AuthenticationMethod(CassandraValue); + /// Determines if two values are the same. + public static bool operator ==(AuthenticationMethod left, AuthenticationMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthenticationMethod left, AuthenticationMethod right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AuthenticationMethod(string value) => new AuthenticationMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthenticationMethod other && Equals(other); + /// + public bool Equals(AuthenticationMethod other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupInformation.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupInformation.Serialization.cs new file mode 100644 index 000000000000..e8de59cd7371 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupInformation.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class BackupInformation + { + internal static BackupInformation DeserializeBackupInformation(JsonElement element) + { + Optional continuousBackupInformation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("continuousBackupInformation")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + continuousBackupInformation = ContinuousBackupInformation.DeserializeContinuousBackupInformation(property.Value); + continue; + } + } + return new BackupInformation(continuousBackupInformation.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupInformation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupInformation.cs new file mode 100644 index 000000000000..6ac0e4f7c71a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupInformation.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Backup information of a resource. + public partial class BackupInformation + { + /// Initializes a new instance of BackupInformation. + internal BackupInformation() + { + } + + /// Initializes a new instance of BackupInformation. + /// Information about the status of continuous backups. + internal BackupInformation(ContinuousBackupInformation continuousBackupInformation) + { + ContinuousBackupInformation = continuousBackupInformation; + } + + /// Information about the status of continuous backups. + public ContinuousBackupInformation ContinuousBackupInformation { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicy.Serialization.cs new file mode 100644 index 000000000000..aa60f1beb12d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicy.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class BackupPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(MigrationState)) + { + writer.WritePropertyName("migrationState"); + writer.WriteObjectValue(MigrationState); + } + writer.WriteEndObject(); + } + + internal static BackupPolicy DeserializeBackupPolicy(JsonElement element) + { + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Continuous": return ContinuousModeBackupPolicy.DeserializeContinuousModeBackupPolicy(element); + case "Periodic": return PeriodicModeBackupPolicy.DeserializePeriodicModeBackupPolicy(element); + } + } + BackupPolicyType type = default; + Optional migrationState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + type = new BackupPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("migrationState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + migrationState = BackupPolicyMigrationState.DeserializeBackupPolicyMigrationState(property.Value); + continue; + } + } + return new BackupPolicy(type, migrationState.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicy.cs new file mode 100644 index 000000000000..2d356dcbc3c9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicy.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The object representing the policy for taking backups on an account. + public partial class BackupPolicy + { + /// Initializes a new instance of BackupPolicy. + public BackupPolicy() + { + } + + /// Initializes a new instance of BackupPolicy. + /// Describes the mode of backups. + /// The object representing the state of the migration between the backup policies. + internal BackupPolicy(BackupPolicyType type, BackupPolicyMigrationState migrationState) + { + Type = type; + MigrationState = migrationState; + } + + /// Describes the mode of backups. + internal BackupPolicyType Type { get; set; } + /// The object representing the state of the migration between the backup policies. + public BackupPolicyMigrationState MigrationState { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.Serialization.cs new file mode 100644 index 000000000000..b0c4d01981c4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class BackupPolicyMigrationState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(TargetType)) + { + writer.WritePropertyName("targetType"); + writer.WriteStringValue(TargetType.Value.ToString()); + } + if (Optional.IsDefined(StartTime)) + { + writer.WritePropertyName("startTime"); + writer.WriteStringValue(StartTime.Value, "O"); + } + writer.WriteEndObject(); + } + + internal static BackupPolicyMigrationState DeserializeBackupPolicyMigrationState(JsonElement element) + { + Optional status = default; + Optional targetType = default; + Optional startTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new BackupPolicyMigrationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + targetType = new BackupPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("startTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new BackupPolicyMigrationState(Optional.ToNullable(status), Optional.ToNullable(targetType), Optional.ToNullable(startTime)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.cs new file mode 100644 index 000000000000..41896bd4b70b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The object representing the state of the migration between the backup policies. + public partial class BackupPolicyMigrationState + { + /// Initializes a new instance of BackupPolicyMigrationState. + public BackupPolicyMigrationState() + { + } + + /// Initializes a new instance of BackupPolicyMigrationState. + /// Describes the status of migration between backup policy types. + /// Describes the target backup policy type of the backup policy migration. + /// Time at which the backup policy migration started (ISO-8601 format). + internal BackupPolicyMigrationState(BackupPolicyMigrationStatus? status, BackupPolicyType? targetType, DateTimeOffset? startTime) + { + Status = status; + TargetType = targetType; + StartTime = startTime; + } + + /// Describes the status of migration between backup policy types. + public BackupPolicyMigrationStatus? Status { get; set; } + /// Describes the target backup policy type of the backup policy migration. + public BackupPolicyType? TargetType { get; set; } + /// Time at which the backup policy migration started (ISO-8601 format). + public DateTimeOffset? StartTime { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationStatus.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationStatus.cs new file mode 100644 index 000000000000..2854a78ea13b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the status of migration between backup policy types. + public readonly partial struct BackupPolicyMigrationStatus : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public BackupPolicyMigrationStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidValue = "Invalid"; + private const string InProgressValue = "InProgress"; + private const string CompletedValue = "Completed"; + private const string FailedValue = "Failed"; + + /// Invalid. + public static BackupPolicyMigrationStatus Invalid { get; } = new BackupPolicyMigrationStatus(InvalidValue); + /// InProgress. + public static BackupPolicyMigrationStatus InProgress { get; } = new BackupPolicyMigrationStatus(InProgressValue); + /// Completed. + public static BackupPolicyMigrationStatus Completed { get; } = new BackupPolicyMigrationStatus(CompletedValue); + /// Failed. + public static BackupPolicyMigrationStatus Failed { get; } = new BackupPolicyMigrationStatus(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(BackupPolicyMigrationStatus left, BackupPolicyMigrationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BackupPolicyMigrationStatus left, BackupPolicyMigrationStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator BackupPolicyMigrationStatus(string value) => new BackupPolicyMigrationStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BackupPolicyMigrationStatus other && Equals(other); + /// + public bool Equals(BackupPolicyMigrationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyType.cs new file mode 100644 index 000000000000..7c6e827707be --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the mode of backups. + public readonly partial struct BackupPolicyType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public BackupPolicyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PeriodicValue = "Periodic"; + private const string ContinuousValue = "Continuous"; + + /// Periodic. + public static BackupPolicyType Periodic { get; } = new BackupPolicyType(PeriodicValue); + /// Continuous. + public static BackupPolicyType Continuous { get; } = new BackupPolicyType(ContinuousValue); + /// Determines if two values are the same. + public static bool operator ==(BackupPolicyType left, BackupPolicyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BackupPolicyType left, BackupPolicyType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator BackupPolicyType(string value) => new BackupPolicyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BackupPolicyType other && Equals(other); + /// + public bool Equals(BackupPolicyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResource.Serialization.cs new file mode 100644 index 000000000000..75e959e2e4eb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResource.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class BackupResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static BackupResource DeserializeBackupResource(JsonElement element) + { + Optional properties = default; + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = BackupResourceProperties.DeserializeBackupResourceProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new BackupResource(id.Value, name.Value, type.Value, properties.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResource.cs new file mode 100644 index 000000000000..40afddef3dbb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A restorable backup of a Cassandra cluster. + public partial class BackupResource : ARMProxyResource + { + /// Initializes a new instance of BackupResource. + public BackupResource() + { + } + + /// Initializes a new instance of BackupResource. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + /// . + internal BackupResource(string id, string name, string type, BackupResourceProperties properties) : base(id, name, type) + { + Properties = properties; + } + + public BackupResourceProperties Properties { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs new file mode 100644 index 000000000000..f661b8f83d9c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class BackupResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"); + writer.WriteStringValue(Timestamp.Value, "O"); + } + writer.WriteEndObject(); + } + + internal static BackupResourceProperties DeserializeBackupResourceProperties(JsonElement element) + { + Optional timestamp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timestamp")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new BackupResourceProperties(Optional.ToNullable(timestamp)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs new file mode 100644 index 000000000000..4e4e6f7e579a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The BackupResourceProperties. + public partial class BackupResourceProperties + { + /// Initializes a new instance of BackupResourceProperties. + public BackupResourceProperties() + { + } + + /// Initializes a new instance of BackupResourceProperties. + /// The time this backup was taken, formatted like 2021-01-21T17:35:21. + internal BackupResourceProperties(DateTimeOffset? timestamp) + { + Timestamp = timestamp; + } + + /// The time this backup was taken, formatted like 2021-01-21T17:35:21. + public DateTimeOffset? Timestamp { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupStorageRedundancy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupStorageRedundancy.cs new file mode 100644 index 000000000000..4be3dd4f3881 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupStorageRedundancy.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Enum to indicate type of backup storage redundancy. + public readonly partial struct BackupStorageRedundancy : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public BackupStorageRedundancy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GeoValue = "Geo"; + private const string LocalValue = "Local"; + private const string ZoneValue = "Zone"; + + /// Geo. + public static BackupStorageRedundancy Geo { get; } = new BackupStorageRedundancy(GeoValue); + /// Local. + public static BackupStorageRedundancy Local { get; } = new BackupStorageRedundancy(LocalValue); + /// Zone. + public static BackupStorageRedundancy Zone { get; } = new BackupStorageRedundancy(ZoneValue); + /// Determines if two values are the same. + public static bool operator ==(BackupStorageRedundancy left, BackupStorageRedundancy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BackupStorageRedundancy left, BackupStorageRedundancy right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator BackupStorageRedundancy(string value) => new BackupStorageRedundancy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BackupStorageRedundancy other && Equals(other); + /// + public bool Equals(BackupStorageRedundancy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.Serialization.cs index b786a3e2ebd5..66bff0615484 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static CassandraKeyspaceCreateUpdateParameters DeserializeCassandraKeys Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; CassandraKeyspaceResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static CassandraKeyspaceCreateUpdateParameters DeserializeCassandraKeys tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static CassandraKeyspaceCreateUpdateParameters DeserializeCassandraKeys } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static CassandraKeyspaceCreateUpdateParameters DeserializeCassandraKeys continue; } } - return new CassandraKeyspaceCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new CassandraKeyspaceCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.cs index 1bbda50440fe..b13494540e53 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class CassandraKeyspaceCreateUpdateParameters : ARMResourceProper { /// Initializes a new instance of CassandraKeyspaceCreateUpdateParameters. /// The standard JSON format of a Cassandra keyspace. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public CassandraKeyspaceCreateUpdateParameters(CassandraKeyspaceResource resource, CreateUpdateOptions options) + /// is null. + public CassandraKeyspaceCreateUpdateParameters(CassandraKeyspaceResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of CassandraKeyspaceCreateUpdateParameters. @@ -38,9 +32,10 @@ public CassandraKeyspaceCreateUpdateParameters(CassandraKeyspaceResource resourc /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a Cassandra keyspace. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal CassandraKeyspaceCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, CassandraKeyspaceResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal CassandraKeyspaceCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, CassandraKeyspaceResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.Serialization.cs index d9f9c8656f0c..70ff118c6780 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.Serialization.cs @@ -23,7 +23,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static CassandraKeyspaceGetPropertiesResource DeserializeCassandraKeyspaceGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; foreach (var property in element.EnumerateObject()) @@ -40,7 +40,7 @@ internal static CassandraKeyspaceGetPropertiesResource DeserializeCassandraKeysp property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -54,7 +54,7 @@ internal static CassandraKeyspaceGetPropertiesResource DeserializeCassandraKeysp continue; } } - return new CassandraKeyspaceGetPropertiesResource(id, Rid.Value, Ts.Value, Etag.Value); + return new CassandraKeyspaceGetPropertiesResource(id, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.cs index 45e2c3d9a901..096d5a258a88 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetPropertiesResource.cs @@ -29,7 +29,7 @@ public CassandraKeyspaceGetPropertiesResource(string id) : base(id) /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. /// is null. - internal CassandraKeyspaceGetPropertiesResource(string id, string rid, object ts, string etag) : base(id) + internal CassandraKeyspaceGetPropertiesResource(string id, string rid, float? ts, string etag) : base(id) { if (id == null) { @@ -44,7 +44,7 @@ internal CassandraKeyspaceGetPropertiesResource(string id, string rid, object ts /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.Serialization.cs index c229ca0c4af9..4ba1e0f4744a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static CassandraKeyspaceGetResults DeserializeCassandraKeyspaceGetResul Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static CassandraKeyspaceGetResults DeserializeCassandraKeyspaceGetResul tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static CassandraKeyspaceGetResults DeserializeCassandraKeyspaceGetResul continue; } } - return new CassandraKeyspaceGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new CassandraKeyspaceGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.cs index 56ccee8c4592..8258634462ff 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceGetResults.cs @@ -23,9 +23,10 @@ public CassandraKeyspaceGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal CassandraKeyspaceGetResults(string id, string name, string type, string location, IDictionary tags, CassandraKeyspaceGetPropertiesResource resource, CassandraKeyspaceGetPropertiesOptions options) : base(id, name, type, location, tags) + internal CassandraKeyspaceGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, CassandraKeyspaceGetPropertiesResource resource, CassandraKeyspaceGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.Serialization.cs index b24131334f8c..6eccece41961 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static CassandraTableCreateUpdateParameters DeserializeCassandraTableCr Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; CassandraTableResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static CassandraTableCreateUpdateParameters DeserializeCassandraTableCr tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static CassandraTableCreateUpdateParameters DeserializeCassandraTableCr } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static CassandraTableCreateUpdateParameters DeserializeCassandraTableCr continue; } } - return new CassandraTableCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new CassandraTableCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.cs index b7eaa5f12c2a..c0dcbc44c5cf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class CassandraTableCreateUpdateParameters : ARMResourcePropertie { /// Initializes a new instance of CassandraTableCreateUpdateParameters. /// The standard JSON format of a Cassandra table. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public CassandraTableCreateUpdateParameters(CassandraTableResource resource, CreateUpdateOptions options) + /// is null. + public CassandraTableCreateUpdateParameters(CassandraTableResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of CassandraTableCreateUpdateParameters. @@ -38,9 +32,10 @@ public CassandraTableCreateUpdateParameters(CassandraTableResource resource, Cre /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a Cassandra table. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal CassandraTableCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, CassandraTableResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal CassandraTableCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, CassandraTableResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.Serialization.cs index 06bfcfb2a5d0..b03466b3cd31 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.Serialization.cs @@ -38,7 +38,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static CassandraTableGetPropertiesResource DeserializeCassandraTableGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; Optional defaultTtl = default; @@ -58,7 +58,7 @@ internal static CassandraTableGetPropertiesResource DeserializeCassandraTableGet property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -102,7 +102,7 @@ internal static CassandraTableGetPropertiesResource DeserializeCassandraTableGet continue; } } - return new CassandraTableGetPropertiesResource(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl), Rid.Value, Ts.Value, Etag.Value); + return new CassandraTableGetPropertiesResource(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl), Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.cs index 1836d9c92ea0..dc43cb5f4b0a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetPropertiesResource.cs @@ -31,7 +31,7 @@ public CassandraTableGetPropertiesResource(string id) : base(id) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal CassandraTableGetPropertiesResource(string id, int? defaultTtl, CassandraSchema schema, int? analyticalStorageTtl, string rid, object ts, string etag) : base(id, defaultTtl, schema, analyticalStorageTtl) + internal CassandraTableGetPropertiesResource(string id, int? defaultTtl, CassandraSchema schema, int? analyticalStorageTtl, string rid, float? ts, string etag) : base(id, defaultTtl, schema, analyticalStorageTtl) { Rid = rid; Ts = ts; @@ -41,7 +41,7 @@ internal CassandraTableGetPropertiesResource(string id, int? defaultTtl, Cassand /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.Serialization.cs index 76a642dcc39d..bd6b941f1d2c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static CassandraTableGetResults DeserializeCassandraTableGetResults(Jso Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static CassandraTableGetResults DeserializeCassandraTableGetResults(Jso tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static CassandraTableGetResults DeserializeCassandraTableGetResults(Jso continue; } } - return new CassandraTableGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new CassandraTableGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.cs index a74586acc734..79e61061c343 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableGetResults.cs @@ -23,9 +23,10 @@ public CassandraTableGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal CassandraTableGetResults(string id, string name, string type, string location, IDictionary tags, CassandraTableGetPropertiesResource resource, CassandraTableGetPropertiesOptions options) : base(id, name, type, location, tags) + internal CassandraTableGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, CassandraTableGetPropertiesResource resource, CassandraTableGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..cd605b45171e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewCreateUpdateParameters.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraViewCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static CassandraViewCreateUpdateParameters DeserializeCassandraViewCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional identity = default; + CassandraViewResource resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = CassandraViewResource.DeserializeCassandraViewResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new CassandraViewCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewCreateUpdateParameters.cs new file mode 100644 index 000000000000..2c7788600088 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewCreateUpdateParameters.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB Cassandra view. + public partial class CassandraViewCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of CassandraViewCreateUpdateParameters. + /// The standard JSON format of a Cassandra view. + /// is null. + public CassandraViewCreateUpdateParameters(CassandraViewResource resource) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + + Resource = resource; + } + + /// Initializes a new instance of CassandraViewCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. + /// The standard JSON format of a Cassandra view. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal CassandraViewCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, CassandraViewResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a Cassandra view. + public CassandraViewResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..d7b7bd200b49 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraViewGetPropertiesOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Throughput)) + { + writer.WritePropertyName("throughput"); + writer.WriteNumberValue(Throughput.Value); + } + if (Optional.IsDefined(AutoscaleSettings)) + { + writer.WritePropertyName("autoscaleSettings"); + writer.WriteObjectValue(AutoscaleSettings); + } + writer.WriteEndObject(); + } + + internal static CassandraViewGetPropertiesOptions DeserializeCassandraViewGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new CassandraViewGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.cs new file mode 100644 index 000000000000..281320d93c64 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CassandraViewGetPropertiesOptions. + public partial class CassandraViewGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of CassandraViewGetPropertiesOptions. + public CassandraViewGetPropertiesOptions() + { + } + + /// Initializes a new instance of CassandraViewGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal CassandraViewGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..0913408ad912 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraViewGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WritePropertyName("viewDefinition"); + writer.WriteStringValue(ViewDefinition); + writer.WriteEndObject(); + } + + internal static CassandraViewGetPropertiesResource DeserializeCassandraViewGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + string viewDefinition = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Ts = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("viewDefinition")) + { + viewDefinition = property.Value.GetString(); + continue; + } + } + return new CassandraViewGetPropertiesResource(id, viewDefinition, Rid.Value, Optional.ToNullable(Ts), Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.cs new file mode 100644 index 000000000000..d785e97e19cc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CassandraViewGetPropertiesResource. + public partial class CassandraViewGetPropertiesResource : CassandraViewResource + { + /// Initializes a new instance of CassandraViewGetPropertiesResource. + /// Name of the Cosmos DB Cassandra view. + /// View Definition of the Cosmos DB Cassandra view. + /// or is null. + public CassandraViewGetPropertiesResource(string id, string viewDefinition) : base(id, viewDefinition) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + if (viewDefinition == null) + { + throw new ArgumentNullException(nameof(viewDefinition)); + } + } + + /// Initializes a new instance of CassandraViewGetPropertiesResource. + /// Name of the Cosmos DB Cassandra view. + /// View Definition of the Cosmos DB Cassandra view. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + /// or is null. + internal CassandraViewGetPropertiesResource(string id, string viewDefinition, string rid, float? ts, string etag) : base(id, viewDefinition) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + if (viewDefinition == null) + { + throw new ArgumentNullException(nameof(viewDefinition)); + } + + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public float? Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResults.Serialization.cs new file mode 100644 index 000000000000..cba61bcdd9dd --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResults.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraViewGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static CassandraViewGetResults DeserializeCassandraViewGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional identity = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + resource = CassandraViewGetPropertiesResource.DeserializeCassandraViewGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + options = CassandraViewGetPropertiesOptions.DeserializeCassandraViewGetPropertiesOptions(property0.Value); + continue; + } + } + continue; + } + } + return new CassandraViewGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResults.cs new file mode 100644 index 000000000000..4d6a0c07596c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResults.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB Cassandra view. + public partial class CassandraViewGetResults : ARMResourceProperties + { + /// Initializes a new instance of CassandraViewGetResults. + public CassandraViewGetResults() + { + } + + /// Initializes a new instance of CassandraViewGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. + /// . + /// . + internal CassandraViewGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, CassandraViewGetPropertiesResource resource, CassandraViewGetPropertiesOptions options) : base(id, name, type, location, tags, identity) + { + Resource = resource; + Options = options; + } + + public CassandraViewGetPropertiesResource Resource { get; set; } + public CassandraViewGetPropertiesOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.Serialization.cs new file mode 100644 index 000000000000..c98be385045b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class CassandraViewListResult + { + internal static CassandraViewListResult DeserializeCassandraViewListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CassandraViewGetResults.DeserializeCassandraViewGetResults(item)); + } + value = array; + continue; + } + } + return new CassandraViewListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.cs new file mode 100644 index 000000000000..31fe6848ecc1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the Cassandra views and their properties. + internal partial class CassandraViewListResult + { + /// Initializes a new instance of CassandraViewListResult. + internal CassandraViewListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of CassandraViewListResult. + /// List of Cassandra views and their properties. + internal CassandraViewListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Cassandra views and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.Serialization.cs new file mode 100644 index 000000000000..0d1b9c305c66 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.Serialization.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraViewResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WritePropertyName("viewDefinition"); + writer.WriteStringValue(ViewDefinition); + writer.WriteEndObject(); + } + + internal static CassandraViewResource DeserializeCassandraViewResource(JsonElement element) + { + string id = default; + string viewDefinition = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("viewDefinition")) + { + viewDefinition = property.Value.GetString(); + continue; + } + } + return new CassandraViewResource(id, viewDefinition); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.cs new file mode 100644 index 000000000000..30a161517c83 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Cassandra view resource object. + public partial class CassandraViewResource + { + /// Initializes a new instance of CassandraViewResource. + /// Name of the Cosmos DB Cassandra view. + /// View Definition of the Cosmos DB Cassandra view. + /// or is null. + public CassandraViewResource(string id, string viewDefinition) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + if (viewDefinition == null) + { + throw new ArgumentNullException(nameof(viewDefinition)); + } + + Id = id; + ViewDefinition = viewDefinition; + } + + /// Name of the Cosmos DB Cassandra view. + public string Id { get; set; } + /// View Definition of the Cosmos DB Cassandra view. + public string ViewDefinition { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Certificate.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Certificate.Serialization.cs new file mode 100644 index 000000000000..e7d28dd31f5b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Certificate.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Certificate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Pem)) + { + writer.WritePropertyName("pem"); + writer.WriteStringValue(Pem); + } + writer.WriteEndObject(); + } + + internal static Certificate DeserializeCertificate(JsonElement element) + { + Optional pem = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("pem")) + { + pem = property.Value.GetString(); + continue; + } + } + return new Certificate(pem.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Certificate.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Certificate.cs new file mode 100644 index 000000000000..a45b005b8506 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Certificate.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The Certificate. + public partial class Certificate + { + /// Initializes a new instance of Certificate. + public Certificate() + { + } + + /// Initializes a new instance of Certificate. + /// PEM formatted public key. + internal Certificate(string pem) + { + Pem = pem; + } + + /// PEM formatted public key. + public string Pem { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CloudError.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CloudError.Serialization.cs new file mode 100644 index 000000000000..961653adbdfc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CloudError.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class CloudError + { + internal static CloudError DeserializeCloudError(JsonElement element) + { + Optional error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value); + continue; + } + } + return new CloudError(error.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CloudError.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CloudError.cs new file mode 100644 index 000000000000..f806058d748d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CloudError.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An error response from the service. + internal partial class CloudError + { + /// Initializes a new instance of CloudError. + internal CloudError() + { + } + + /// Initializes a new instance of CloudError. + /// Error Response. + internal CloudError(ErrorResponse error) + { + Error = error; + } + + /// Error Response. + public ErrorResponse Error { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatus.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatus.Serialization.cs new file mode 100644 index 000000000000..cf5e44db382e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatus.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ClusterNodeStatus + { + internal static ClusterNodeStatus DeserializeClusterNodeStatus(JsonElement element) + { + Optional> nodes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nodes")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClusterNodeStatusNodesItem.DeserializeClusterNodeStatusNodesItem(item)); + } + nodes = array; + continue; + } + } + return new ClusterNodeStatus(Optional.ToList(nodes)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatus.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatus.cs new file mode 100644 index 000000000000..bdef7dec815a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatus.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The status of all nodes in the cluster (as returned by 'nodetool status'). + public partial class ClusterNodeStatus + { + /// Initializes a new instance of ClusterNodeStatus. + internal ClusterNodeStatus() + { + Nodes = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClusterNodeStatus. + /// Information about nodes in the cluster (corresponds to what is returned from nodetool info). + internal ClusterNodeStatus(IReadOnlyList nodes) + { + Nodes = nodes; + } + + /// Information about nodes in the cluster (corresponds to what is returned from nodetool info). + public IReadOnlyList Nodes { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatusNodesItem.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatusNodesItem.Serialization.cs new file mode 100644 index 000000000000..2c769916e6d1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatusNodesItem.Serialization.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ClusterNodeStatusNodesItem + { + internal static ClusterNodeStatusNodesItem DeserializeClusterNodeStatusNodesItem(JsonElement element) + { + Optional datacenter = default; + Optional status = default; + Optional state = default; + Optional address = default; + Optional load = default; + Optional> tokens = default; + Optional owns = default; + Optional hostId = default; + Optional rack = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("datacenter")) + { + datacenter = property.Value.GetString(); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new NodeStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("state")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + state = new NodeState(property.Value.GetString()); + continue; + } + if (property.NameEquals("address")) + { + address = property.Value.GetString(); + continue; + } + if (property.NameEquals("load")) + { + load = property.Value.GetString(); + continue; + } + if (property.NameEquals("tokens")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + tokens = array; + continue; + } + if (property.NameEquals("owns")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + owns = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("hostId")) + { + hostId = property.Value.GetString(); + continue; + } + if (property.NameEquals("rack")) + { + rack = property.Value.GetString(); + continue; + } + } + return new ClusterNodeStatusNodesItem(datacenter.Value, Optional.ToNullable(status), Optional.ToNullable(state), address.Value, load.Value, Optional.ToList(tokens), Optional.ToNullable(owns), hostId.Value, rack.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatusNodesItem.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatusNodesItem.cs new file mode 100644 index 000000000000..a05e77eff557 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterNodeStatusNodesItem.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The ClusterNodeStatusNodesItem. + public partial class ClusterNodeStatusNodesItem + { + /// Initializes a new instance of ClusterNodeStatusNodesItem. + internal ClusterNodeStatusNodesItem() + { + Tokens = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClusterNodeStatusNodesItem. + /// The Cassandra data center this node resides in. + /// Indicates whether the node is functioning or not. + /// The state of the node in relation to the cluster. + /// The node's URL. + /// The amount of file system data in the data directory (e.g., 47.66 KB), excluding all content in the snapshots subdirectories. Because all SSTable data files are included, any data that is not cleaned up (such as TTL-expired cell or tombstoned data) is counted. + /// List of tokens. + /// The percentage of the data owned by the node per datacenter times the replication factor (e.g., 33.3, or null if the data is not available). For example, a node can own 33% of the ring, but shows 100% if the replication factor is 3. For non-system keyspaces, the endpoint percentage ownership information is shown. + /// The network ID of the node. + /// The rack this node is part of. + internal ClusterNodeStatusNodesItem(string datacenter, NodeStatus? status, NodeState? state, string address, string load, IReadOnlyList tokens, double? owns, string hostId, string rack) + { + Datacenter = datacenter; + Status = status; + State = state; + Address = address; + Load = load; + Tokens = tokens; + Owns = owns; + HostId = hostId; + Rack = rack; + } + + /// The Cassandra data center this node resides in. + public string Datacenter { get; } + /// Indicates whether the node is functioning or not. + public NodeStatus? Status { get; } + /// The state of the node in relation to the cluster. + public NodeState? State { get; } + /// The node's URL. + public string Address { get; } + /// The amount of file system data in the data directory (e.g., 47.66 KB), excluding all content in the snapshots subdirectories. Because all SSTable data files are included, any data that is not cleaned up (such as TTL-expired cell or tombstoned data) is counted. + public string Load { get; } + /// List of tokens. + public IReadOnlyList Tokens { get; } + /// The percentage of the data owned by the node per datacenter times the replication factor (e.g., 33.3, or null if the data is not available). For example, a node can own 33% of the ring, but shows 100% if the replication factor is 3. For non-system keyspaces, the endpoint percentage ownership information is shown. + public double? Owns { get; } + /// The network ID of the node. + public string HostId { get; } + /// The rack this node is part of. + public string Rack { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResource.Serialization.cs new file mode 100644 index 000000000000..62db27b90ae7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResource.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ClusterResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + writer.WriteEndObject(); + } + + internal static ClusterResource DeserializeClusterResource(JsonElement element) + { + Optional properties = default; + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional identity = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = ClusterResourceProperties.DeserializeClusterResourceProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } + } + return new ClusterResource(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, properties.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResource.cs new file mode 100644 index 000000000000..22c669db1f94 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Representation of a managed Cassandra cluster. + public partial class ClusterResource : ARMResourceProperties + { + /// Initializes a new instance of ClusterResource. + public ClusterResource() + { + } + + /// Initializes a new instance of ClusterResource. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. + /// Properties of a managed Cassandra cluster. + internal ClusterResource(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, ClusterResourceProperties properties) : base(id, name, type, location, tags, identity) + { + Properties = properties; + } + + /// Properties of a managed Cassandra cluster. + public ClusterResourceProperties Properties { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResourceProperties.Serialization.cs new file mode 100644 index 000000000000..3ebed244f523 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResourceProperties.Serialization.cs @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ClusterResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(RestoreFromBackupId)) + { + writer.WritePropertyName("restoreFromBackupId"); + writer.WriteStringValue(RestoreFromBackupId); + } + if (Optional.IsDefined(DelegatedManagementSubnetId)) + { + writer.WritePropertyName("delegatedManagementSubnetId"); + writer.WriteStringValue(DelegatedManagementSubnetId); + } + if (Optional.IsDefined(CassandraVersion)) + { + writer.WritePropertyName("cassandraVersion"); + writer.WriteStringValue(CassandraVersion); + } + if (Optional.IsDefined(ClusterNameOverride)) + { + writer.WritePropertyName("clusterNameOverride"); + writer.WriteStringValue(ClusterNameOverride); + } + if (Optional.IsDefined(AuthenticationMethod)) + { + writer.WritePropertyName("authenticationMethod"); + writer.WriteStringValue(AuthenticationMethod.Value.ToString()); + } + if (Optional.IsDefined(InitialCassandraAdminPassword)) + { + writer.WritePropertyName("initialCassandraAdminPassword"); + writer.WriteStringValue(InitialCassandraAdminPassword); + } + if (Optional.IsDefined(HoursBetweenBackups)) + { + writer.WritePropertyName("hoursBetweenBackups"); + writer.WriteNumberValue(HoursBetweenBackups.Value); + } + if (Optional.IsDefined(PrometheusEndpoint)) + { + writer.WritePropertyName("prometheusEndpoint"); + writer.WriteObjectValue(PrometheusEndpoint); + } + if (Optional.IsDefined(RepairEnabled)) + { + writer.WritePropertyName("repairEnabled"); + writer.WriteBooleanValue(RepairEnabled.Value); + } + if (Optional.IsCollectionDefined(ClientCertificates)) + { + writer.WritePropertyName("clientCertificates"); + writer.WriteStartArray(); + foreach (var item in ClientCertificates) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ExternalGossipCertificates)) + { + writer.WritePropertyName("externalGossipCertificates"); + writer.WriteStartArray(); + foreach (var item in ExternalGossipCertificates) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ExternalSeedNodes)) + { + writer.WritePropertyName("externalSeedNodes"); + writer.WriteStartArray(); + foreach (var item in ExternalSeedNodes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ClusterResourceProperties DeserializeClusterResourceProperties(JsonElement element) + { + Optional provisioningState = default; + Optional restoreFromBackupId = default; + Optional delegatedManagementSubnetId = default; + Optional cassandraVersion = default; + Optional clusterNameOverride = default; + Optional authenticationMethod = default; + Optional initialCassandraAdminPassword = default; + Optional hoursBetweenBackups = default; + Optional prometheusEndpoint = default; + Optional repairEnabled = default; + Optional> clientCertificates = default; + Optional> externalGossipCertificates = default; + Optional> gossipCertificates = default; + Optional> externalSeedNodes = default; + Optional> seedNodes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ManagedCassandraProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("restoreFromBackupId")) + { + restoreFromBackupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("delegatedManagementSubnetId")) + { + delegatedManagementSubnetId = property.Value.GetString(); + continue; + } + if (property.NameEquals("cassandraVersion")) + { + cassandraVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("clusterNameOverride")) + { + clusterNameOverride = property.Value.GetString(); + continue; + } + if (property.NameEquals("authenticationMethod")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + authenticationMethod = new AuthenticationMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("initialCassandraAdminPassword")) + { + initialCassandraAdminPassword = property.Value.GetString(); + continue; + } + if (property.NameEquals("hoursBetweenBackups")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + hoursBetweenBackups = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("prometheusEndpoint")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + prometheusEndpoint = SeedNode.DeserializeSeedNode(property.Value); + continue; + } + if (property.NameEquals("repairEnabled")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + repairEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("clientCertificates")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Certificate.DeserializeCertificate(item)); + } + clientCertificates = array; + continue; + } + if (property.NameEquals("externalGossipCertificates")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Certificate.DeserializeCertificate(item)); + } + externalGossipCertificates = array; + continue; + } + if (property.NameEquals("gossipCertificates")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Certificate.DeserializeCertificate(item)); + } + gossipCertificates = array; + continue; + } + if (property.NameEquals("externalSeedNodes")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SeedNode.DeserializeSeedNode(item)); + } + externalSeedNodes = array; + continue; + } + if (property.NameEquals("seedNodes")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SeedNode.DeserializeSeedNode(item)); + } + seedNodes = array; + continue; + } + } + return new ClusterResourceProperties(Optional.ToNullable(provisioningState), restoreFromBackupId.Value, delegatedManagementSubnetId.Value, cassandraVersion.Value, clusterNameOverride.Value, Optional.ToNullable(authenticationMethod), initialCassandraAdminPassword.Value, Optional.ToNullable(hoursBetweenBackups), prometheusEndpoint.Value, Optional.ToNullable(repairEnabled), Optional.ToList(clientCertificates), Optional.ToList(externalGossipCertificates), Optional.ToList(gossipCertificates), Optional.ToList(externalSeedNodes), Optional.ToList(seedNodes)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResourceProperties.cs new file mode 100644 index 000000000000..4fffcf8b5e8f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClusterResourceProperties.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties of a managed Cassandra cluster. + public partial class ClusterResourceProperties + { + /// Initializes a new instance of ClusterResourceProperties. + public ClusterResourceProperties() + { + ClientCertificates = new ChangeTrackingList(); + ExternalGossipCertificates = new ChangeTrackingList(); + GossipCertificates = new ChangeTrackingList(); + ExternalSeedNodes = new ChangeTrackingList(); + SeedNodes = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClusterResourceProperties. + /// The status of the resource at the time the operation was called. + /// To create an empty cluster, omit this field or set it to null. To restore a backup into a new cluster, set this field to the resource id of the backup. + /// Resource id of a subnet that this cluster's management service should have its network interface attached to. The subnet must be routable to all subnets that will be delegated to data centers. The resource id must be of the form '/subscriptions/<subscription id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. + /// Which version of Cassandra should this cluster converge to running (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version. + /// If you need to set the clusterName property in cassandra.yaml to something besides the resource name of the cluster, set the value to use on this property. + /// Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password based authentication. The default is 'Cassandra'. + /// Initial password for clients connecting as admin to the cluster. Should be changed after cluster creation. Returns null on GET. This field only applies when the authenticationMethod field is 'Cassandra'. + /// Number of hours to wait between taking a backup of the cluster. To disable backups, set this property to 0. + /// Hostname or IP address where the Prometheus endpoint containing data about the managed Cassandra nodes can be reached. + /// Should automatic repairs run on this cluster? If omitted, this is true, and should stay true unless you are running a hybrid cluster where you are already doing your own repairs. + /// List of TLS certificates used to authorize clients connecting to the cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if clientCertificates is set, the managed Cassandra cluster will reject all connections not bearing a TLS client certificate that can be validated from one or more of the public certificates in this property. + /// List of TLS certificates used to authorize gossip from unmanaged data centers. The TLS certificates of all nodes in unmanaged data centers must be verifiable using one of the certificates provided in this property. + /// List of TLS certificates that unmanaged nodes must trust for gossip with managed nodes. All managed nodes will present TLS client certificates that are verifiable using one of the certificates provided in this property. + /// List of IP addresses of seed nodes in unmanaged data centers. These will be added to the seed node lists of all managed nodes. + /// List of IP addresses of seed nodes in the managed data centers. These should be added to the seed node lists of all unmanaged nodes. + internal ClusterResourceProperties(ManagedCassandraProvisioningState? provisioningState, string restoreFromBackupId, string delegatedManagementSubnetId, string cassandraVersion, string clusterNameOverride, AuthenticationMethod? authenticationMethod, string initialCassandraAdminPassword, int? hoursBetweenBackups, SeedNode prometheusEndpoint, bool? repairEnabled, IList clientCertificates, IList externalGossipCertificates, IReadOnlyList gossipCertificates, IList externalSeedNodes, IReadOnlyList seedNodes) + { + ProvisioningState = provisioningState; + RestoreFromBackupId = restoreFromBackupId; + DelegatedManagementSubnetId = delegatedManagementSubnetId; + CassandraVersion = cassandraVersion; + ClusterNameOverride = clusterNameOverride; + AuthenticationMethod = authenticationMethod; + InitialCassandraAdminPassword = initialCassandraAdminPassword; + HoursBetweenBackups = hoursBetweenBackups; + PrometheusEndpoint = prometheusEndpoint; + RepairEnabled = repairEnabled; + ClientCertificates = clientCertificates; + ExternalGossipCertificates = externalGossipCertificates; + GossipCertificates = gossipCertificates; + ExternalSeedNodes = externalSeedNodes; + SeedNodes = seedNodes; + } + + /// The status of the resource at the time the operation was called. + public ManagedCassandraProvisioningState? ProvisioningState { get; set; } + /// To create an empty cluster, omit this field or set it to null. To restore a backup into a new cluster, set this field to the resource id of the backup. + public string RestoreFromBackupId { get; set; } + /// Resource id of a subnet that this cluster's management service should have its network interface attached to. The subnet must be routable to all subnets that will be delegated to data centers. The resource id must be of the form '/subscriptions/<subscription id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. + public string DelegatedManagementSubnetId { get; set; } + /// Which version of Cassandra should this cluster converge to running (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version. + public string CassandraVersion { get; set; } + /// If you need to set the clusterName property in cassandra.yaml to something besides the resource name of the cluster, set the value to use on this property. + public string ClusterNameOverride { get; set; } + /// Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password based authentication. The default is 'Cassandra'. + public AuthenticationMethod? AuthenticationMethod { get; set; } + /// Initial password for clients connecting as admin to the cluster. Should be changed after cluster creation. Returns null on GET. This field only applies when the authenticationMethod field is 'Cassandra'. + public string InitialCassandraAdminPassword { get; set; } + /// Number of hours to wait between taking a backup of the cluster. To disable backups, set this property to 0. + public int? HoursBetweenBackups { get; set; } + /// Hostname or IP address where the Prometheus endpoint containing data about the managed Cassandra nodes can be reached. + public SeedNode PrometheusEndpoint { get; set; } + /// Should automatic repairs run on this cluster? If omitted, this is true, and should stay true unless you are running a hybrid cluster where you are already doing your own repairs. + public bool? RepairEnabled { get; set; } + /// List of TLS certificates used to authorize clients connecting to the cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if clientCertificates is set, the managed Cassandra cluster will reject all connections not bearing a TLS client certificate that can be validated from one or more of the public certificates in this property. + public IList ClientCertificates { get; } + /// List of TLS certificates used to authorize gossip from unmanaged data centers. The TLS certificates of all nodes in unmanaged data centers must be verifiable using one of the certificates provided in this property. + public IList ExternalGossipCertificates { get; } + /// List of TLS certificates that unmanaged nodes must trust for gossip with managed nodes. All managed nodes will present TLS client certificates that are verifiable using one of the certificates provided in this property. + public IReadOnlyList GossipCertificates { get; } + /// List of IP addresses of seed nodes in unmanaged data centers. These will be added to the seed node lists of all managed nodes. + public IList ExternalSeedNodes { get; } + /// List of IP addresses of seed nodes in the managed data centers. These should be added to the seed node lists of all unmanaged nodes. + public IReadOnlyList SeedNodes { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties.Serialization.cs new file mode 100644 index 000000000000..39a0d454daa8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties DeserializeComponents1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(JsonElement element) + { + Optional principalId = default; + Optional clientId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId")) + { + clientId = property.Value.GetString(); + continue; + } + } + return new Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(principalId.Value, clientId.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties.cs new file mode 100644 index 000000000000..b376d2878613 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + public partial class Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties + { + /// Initializes a new instance of Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + public Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties() + { + } + + /// Initializes a new instance of Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. + /// The principal id of user assigned identity. + /// The client id of user assigned identity. + internal Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(string principalId, string clientId) + { + PrincipalId = principalId; + ClientId = clientId; + } + + /// The principal id of user assigned identity. + public string PrincipalId { get; } + /// The client id of user assigned identity. + public string ClientId { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePathSortOrder.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePathSortOrder.cs index 32a704c697ea..fed0fc4de6bf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePathSortOrder.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CompositePathSortOrder.cs @@ -22,12 +22,12 @@ public CompositePathSortOrder(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string AscendingValue = "Ascending"; - private const string DescendingValue = "Descending"; + private const string AscendingValue = "ascending"; + private const string DescendingValue = "descending"; - /// Ascending. + /// ascending. public static CompositePathSortOrder Ascending { get; } = new CompositePathSortOrder(AscendingValue); - /// Descending. + /// descending. public static CompositePathSortOrder Descending { get; } = new CompositePathSortOrder(DescendingValue); /// Determines if two values are the same. public static bool operator ==(CompositePathSortOrder left, CompositePathSortOrder right) => left.Equals(right); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.Serialization.cs index 53a7b630dd93..5aeacdb0580f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.Serialization.cs @@ -44,6 +44,7 @@ internal static ContainerPartitionKey DeserializeContainerPartitionKey(JsonEleme Optional> paths = default; Optional kind = default; Optional version = default; + Optional systemKey = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("paths")) @@ -81,8 +82,18 @@ internal static ContainerPartitionKey DeserializeContainerPartitionKey(JsonEleme version = property.Value.GetInt32(); continue; } + if (property.NameEquals("systemKey")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemKey = property.Value.GetBoolean(); + continue; + } } - return new ContainerPartitionKey(Optional.ToList(paths), Optional.ToNullable(kind), Optional.ToNullable(version)); + return new ContainerPartitionKey(Optional.ToList(paths), Optional.ToNullable(kind), Optional.ToNullable(version), Optional.ToNullable(systemKey)); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.cs index 1065a196f4c7..ea0650ac9bd2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContainerPartitionKey.cs @@ -21,20 +21,24 @@ public ContainerPartitionKey() /// Initializes a new instance of ContainerPartitionKey. /// List of paths using which data within the container can be partitioned. - /// Indicates the kind of algorithm used for partitioning. + /// Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create. /// Indicates the version of the partition key definition. - internal ContainerPartitionKey(IList paths, PartitionKind? kind, int? version) + /// Indicates if the container is using a system generated partition key. + internal ContainerPartitionKey(IList paths, PartitionKind? kind, int? version, bool? systemKey) { Paths = paths; Kind = kind; Version = version; + SystemKey = systemKey; } /// List of paths using which data within the container can be partitioned. public IList Paths { get; } - /// Indicates the kind of algorithm used for partitioning. + /// Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create. public PartitionKind? Kind { get; set; } /// Indicates the version of the partition key definition. public int? Version { get; set; } + /// Indicates if the container is using a system generated partition key. + public bool? SystemKey { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.Serialization.cs new file mode 100644 index 000000000000..5a037bcc7d52 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ContinuousBackupInformation + { + internal static ContinuousBackupInformation DeserializeContinuousBackupInformation(JsonElement element) + { + Optional latestRestorableTimestamp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("latestRestorableTimestamp")) + { + latestRestorableTimestamp = property.Value.GetString(); + continue; + } + } + return new ContinuousBackupInformation(latestRestorableTimestamp.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.cs new file mode 100644 index 000000000000..62ac0a964f17 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Information about the status of continuous backups. + public partial class ContinuousBackupInformation + { + /// Initializes a new instance of ContinuousBackupInformation. + internal ContinuousBackupInformation() + { + } + + /// Initializes a new instance of ContinuousBackupInformation. + /// The latest restorable timestamp for a resource. + internal ContinuousBackupInformation(string latestRestorableTimestamp) + { + LatestRestorableTimestamp = latestRestorableTimestamp; + } + + /// The latest restorable timestamp for a resource. + public string LatestRestorableTimestamp { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.Serialization.cs new file mode 100644 index 000000000000..3cb9cde2aab4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ContinuousBackupRestoreLocation : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.cs new file mode 100644 index 000000000000..6b97c204053b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties of the regional restorable account. + public partial class ContinuousBackupRestoreLocation + { + /// Initializes a new instance of ContinuousBackupRestoreLocation. + public ContinuousBackupRestoreLocation() + { + } + + /// The name of the continuous backup restore location. + public string Location { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.Serialization.cs new file mode 100644 index 000000000000..7622d8e23bc7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ContinuousModeBackupPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(MigrationState)) + { + writer.WritePropertyName("migrationState"); + writer.WriteObjectValue(MigrationState); + } + writer.WriteEndObject(); + } + + internal static ContinuousModeBackupPolicy DeserializeContinuousModeBackupPolicy(JsonElement element) + { + BackupPolicyType type = default; + Optional migrationState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + type = new BackupPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("migrationState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + migrationState = BackupPolicyMigrationState.DeserializeBackupPolicyMigrationState(property.Value); + continue; + } + } + return new ContinuousModeBackupPolicy(type, migrationState.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.cs new file mode 100644 index 000000000000..6e2ab2122c3c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The object representing continuous mode backup policy. + public partial class ContinuousModeBackupPolicy : BackupPolicy + { + /// Initializes a new instance of ContinuousModeBackupPolicy. + public ContinuousModeBackupPolicy() + { + Type = BackupPolicyType.Continuous; + } + + /// Initializes a new instance of ContinuousModeBackupPolicy. + /// Describes the mode of backups. + /// The object representing the state of the migration between the backup policies. + internal ContinuousModeBackupPolicy(BackupPolicyType type, BackupPolicyMigrationState migrationState) : base(type, migrationState) + { + Type = type; + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateMode.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateMode.cs new file mode 100644 index 000000000000..a1fed9d56d4e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreateMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Enum to indicate the mode of account creation. + public readonly partial struct CreateMode : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public CreateMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string RestoreValue = "Restore"; + + /// Default. + public static CreateMode Default { get; } = new CreateMode(DefaultValue); + /// Restore. + public static CreateMode Restore { get; } = new CreateMode(RestoreValue); + /// Determines if two values are the same. + public static bool operator ==(CreateMode left, CreateMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CreateMode left, CreateMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CreateMode(string value) => new CreateMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CreateMode other && Equals(other); + /// + public bool Equals(CreateMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreatedByType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..f84ad52f3602 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The type of identity that created the resource. + public readonly partial struct CreatedByType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public CreatedByType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "User"; + private const string ApplicationValue = "Application"; + private const string ManagedIdentityValue = "ManagedIdentity"; + private const string KeyValue = "Key"; + + /// User. + public static CreatedByType User { get; } = new CreatedByType(UserValue); + /// Application. + public static CreatedByType Application { get; } = new CreatedByType(ApplicationValue); + /// ManagedIdentity. + public static CreatedByType ManagedIdentity { get; } = new CreatedByType(ManagedIdentityValue); + /// Key. + public static CreatedByType Key { get; } = new CreatedByType(KeyValue); + /// Determines if two values are the same. + public static bool operator ==(CreatedByType left, CreatedByType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CreatedByType left, CreatedByType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CreatedByType(string value) => new CreatedByType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CreatedByType other && Equals(other); + /// + public bool Equals(CreatedByType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResource.Serialization.cs new file mode 100644 index 000000000000..44a264e5f7dc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResource.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DataCenterResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static DataCenterResource DeserializeDataCenterResource(JsonElement element) + { + Optional properties = default; + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = DataCenterResourceProperties.DeserializeDataCenterResourceProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new DataCenterResource(id.Value, name.Value, type.Value, properties.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResource.cs new file mode 100644 index 000000000000..7d874b05fe1f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A managed Cassandra data center. + public partial class DataCenterResource : ARMProxyResource + { + /// Initializes a new instance of DataCenterResource. + public DataCenterResource() + { + } + + /// Initializes a new instance of DataCenterResource. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + /// Properties of a managed Cassandra data center. + internal DataCenterResource(string id, string name, string type, DataCenterResourceProperties properties) : base(id, name, type) + { + Properties = properties; + } + + /// Properties of a managed Cassandra data center. + public DataCenterResourceProperties Properties { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResourceProperties.Serialization.cs new file mode 100644 index 000000000000..a20732feed10 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResourceProperties.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DataCenterResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(DataCenterLocation)) + { + writer.WritePropertyName("dataCenterLocation"); + writer.WriteStringValue(DataCenterLocation); + } + if (Optional.IsDefined(DelegatedSubnetId)) + { + writer.WritePropertyName("delegatedSubnetId"); + writer.WriteStringValue(DelegatedSubnetId); + } + if (Optional.IsDefined(NodeCount)) + { + writer.WritePropertyName("nodeCount"); + writer.WriteNumberValue(NodeCount.Value); + } + if (Optional.IsDefined(Base64EncodedCassandraYamlFragment)) + { + writer.WritePropertyName("base64EncodedCassandraYamlFragment"); + writer.WriteStringValue(Base64EncodedCassandraYamlFragment); + } + writer.WriteEndObject(); + } + + internal static DataCenterResourceProperties DeserializeDataCenterResourceProperties(JsonElement element) + { + Optional provisioningState = default; + Optional dataCenterLocation = default; + Optional delegatedSubnetId = default; + Optional nodeCount = default; + Optional> seedNodes = default; + Optional base64EncodedCassandraYamlFragment = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ManagedCassandraProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataCenterLocation")) + { + dataCenterLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("delegatedSubnetId")) + { + delegatedSubnetId = property.Value.GetString(); + continue; + } + if (property.NameEquals("nodeCount")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + nodeCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("seedNodes")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SeedNode.DeserializeSeedNode(item)); + } + seedNodes = array; + continue; + } + if (property.NameEquals("base64EncodedCassandraYamlFragment")) + { + base64EncodedCassandraYamlFragment = property.Value.GetString(); + continue; + } + } + return new DataCenterResourceProperties(Optional.ToNullable(provisioningState), dataCenterLocation.Value, delegatedSubnetId.Value, Optional.ToNullable(nodeCount), Optional.ToList(seedNodes), base64EncodedCassandraYamlFragment.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResourceProperties.cs new file mode 100644 index 000000000000..d17d507818ab --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataCenterResourceProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties of a managed Cassandra data center. + public partial class DataCenterResourceProperties + { + /// Initializes a new instance of DataCenterResourceProperties. + public DataCenterResourceProperties() + { + SeedNodes = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataCenterResourceProperties. + /// The status of the resource at the time the operation was called. + /// The region this data center should be created in. + /// Resource id of a subnet the nodes in this data center should have their network interfaces connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' property. This resource id will be of the form '/subscriptions/<subscription id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. + /// The number of nodes the data center should have. This is the desired number. After it is set, it may take some time for the data center to be scaled to match. To monitor the number of nodes and their status, use the fetchNodeStatus method on the cluster. + /// IP addresses for seed nodes in this data center. This is for reference. Generally you will want to use the seedNodes property on the cluster, which aggregates the seed nodes from all data centers in the cluster. + /// A fragment of a cassandra.yaml configuration file to be included in the cassandra.yaml for all nodes in this data center. The fragment should be Base64 encoded, and only a subset of keys are allowed. + internal DataCenterResourceProperties(ManagedCassandraProvisioningState? provisioningState, string dataCenterLocation, string delegatedSubnetId, int? nodeCount, IReadOnlyList seedNodes, string base64EncodedCassandraYamlFragment) + { + ProvisioningState = provisioningState; + DataCenterLocation = dataCenterLocation; + DelegatedSubnetId = delegatedSubnetId; + NodeCount = nodeCount; + SeedNodes = seedNodes; + Base64EncodedCassandraYamlFragment = base64EncodedCassandraYamlFragment; + } + + /// The status of the resource at the time the operation was called. + public ManagedCassandraProvisioningState? ProvisioningState { get; set; } + /// The region this data center should be created in. + public string DataCenterLocation { get; set; } + /// Resource id of a subnet the nodes in this data center should have their network interfaces connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' property. This resource id will be of the form '/subscriptions/<subscription id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. + public string DelegatedSubnetId { get; set; } + /// The number of nodes the data center should have. This is the desired number. After it is set, it may take some time for the data center to be scaled to match. To monitor the number of nodes and their status, use the fetchNodeStatus method on the cluster. + public int? NodeCount { get; set; } + /// IP addresses for seed nodes in this data center. This is for reference. Generally you will want to use the seedNodes property on the cluster, which aggregates the seed nodes from all data centers in the cluster. + public IReadOnlyList SeedNodes { get; } + /// A fragment of a cassandra.yaml configuration file to be included in the cassandra.yaml for all nodes in this data center. The fragment should be Base64 encoded, and only a subset of keys are allowed. + public string Base64EncodedCassandraYamlFragment { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalServiceResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalServiceResource.Serialization.cs new file mode 100644 index 000000000000..9e4ca2f1f465 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalServiceResource.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DataTransferRegionalServiceResource + { + internal static DataTransferRegionalServiceResource DeserializeDataTransferRegionalServiceResource(JsonElement element) + { + Optional name = default; + Optional location = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new ServiceStatus(property.Value.GetString()); + continue; + } + } + return new DataTransferRegionalServiceResource(name.Value, location.Value, Optional.ToNullable(status)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalServiceResource.cs new file mode 100644 index 000000000000..9f66376267df --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalServiceResource.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Resource for a regional service location. + public partial class DataTransferRegionalServiceResource : RegionalServiceResource + { + /// Initializes a new instance of DataTransferRegionalServiceResource. + internal DataTransferRegionalServiceResource() + { + } + + /// Initializes a new instance of DataTransferRegionalServiceResource. + /// The regional service name. + /// The location name. + /// Describes the status of a service. + internal DataTransferRegionalServiceResource(string name, string location, ServiceStatus? status) : base(name, location, status) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResource.cs new file mode 100644 index 000000000000..aea35308cfe4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResource.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the service response property. + internal partial class DataTransferServiceResource + { + /// Initializes a new instance of DataTransferServiceResource. + internal DataTransferServiceResource() + { + } + + /// Properties for DataTransferServiceResource. + public DataTransferServiceResourceProperties Properties { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResourceProperties.Serialization.cs new file mode 100644 index 000000000000..813d1cc7095b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResourceProperties.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DataTransferServiceResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(InstanceSize)) + { + writer.WritePropertyName("instanceSize"); + writer.WriteStringValue(InstanceSize.Value.ToString()); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"); + writer.WriteNumberValue(InstanceCount.Value); + } + writer.WritePropertyName("serviceType"); + writer.WriteStringValue(ServiceType.ToString()); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + + internal static DataTransferServiceResourceProperties DeserializeDataTransferServiceResourceProperties(JsonElement element) + { + Optional> locations = default; + Optional creationTime = default; + Optional instanceSize = default; + Optional instanceCount = default; + ServiceType serviceType = default; + Optional status = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("locations")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataTransferRegionalServiceResource.DeserializeDataTransferRegionalServiceResource(item)); + } + locations = array; + continue; + } + if (property.NameEquals("creationTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("instanceSize")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + instanceSize = new ServiceSize(property.Value.GetString()); + continue; + } + if (property.NameEquals("instanceCount")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + instanceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("serviceType")) + { + serviceType = new ServiceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new ServiceStatus(property.Value.GetString()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); + } + additionalProperties = additionalPropertiesDictionary; + return new DataTransferServiceResourceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties, Optional.ToList(locations)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResourceProperties.cs new file mode 100644 index 000000000000..7575720e1744 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceResourceProperties.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties for DataTransferServiceResource. + public partial class DataTransferServiceResourceProperties : ServiceResourceProperties + { + /// Initializes a new instance of DataTransferServiceResourceProperties. + public DataTransferServiceResourceProperties() + { + Locations = new ChangeTrackingList(); + ServiceType = ServiceType.DataTransfer; + } + + /// Initializes a new instance of DataTransferServiceResourceProperties. + /// Time of the last state change (ISO-8601 format). + /// Instance type for the service. + /// Instance count for the service. + /// ServiceType for the service. + /// Describes the status of a service. + /// . + /// An array that contains all of the locations for the service. + internal DataTransferServiceResourceProperties(DateTimeOffset? creationTime, ServiceSize? instanceSize, int? instanceCount, ServiceType serviceType, ServiceStatus? status, IDictionary additionalProperties, IReadOnlyList locations) : base(creationTime, instanceSize, instanceCount, serviceType, status, additionalProperties) + { + Locations = locations; + ServiceType = serviceType; + } + + /// An array that contains all of the locations for the service. + public IReadOnlyList Locations { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.Serialization.cs index 4c0cc5fe350d..493609a01371 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.Serialization.cs @@ -37,6 +37,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ConsistencyPolicy)) @@ -118,6 +123,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyVaultKeyUri"); writer.WriteStringValue(KeyVaultKeyUri); } + if (Optional.IsDefined(DefaultIdentity)) + { + writer.WritePropertyName("defaultIdentity"); + writer.WriteStringValue(DefaultIdentity); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } if (Optional.IsDefined(EnableFreeTier)) { writer.WritePropertyName("enableFreeTier"); @@ -133,6 +148,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableAnalyticalStorage"); writer.WriteBooleanValue(EnableAnalyticalStorage.Value); } + if (Optional.IsDefined(AnalyticalStorageConfiguration)) + { + writer.WritePropertyName("analyticalStorageConfiguration"); + writer.WriteObjectValue(AnalyticalStorageConfiguration); + } + writer.WritePropertyName("createMode"); + writer.WriteStringValue(CreateMode.ToString()); + if (Optional.IsDefined(BackupPolicy)) + { + writer.WritePropertyName("backupPolicy"); + writer.WriteObjectValue(BackupPolicy); + } if (Optional.IsCollectionDefined(Cors)) { writer.WritePropertyName("cors"); @@ -143,6 +170,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(NetworkAclBypass)) + { + writer.WritePropertyName("networkAclBypass"); + writer.WriteStringValue(NetworkAclBypass.Value.ToSerialString()); + } + if (Optional.IsCollectionDefined(NetworkAclBypassResourceIds)) + { + writer.WritePropertyName("networkAclBypassResourceIds"); + writer.WriteStartArray(); + foreach (var item in NetworkAclBypassResourceIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DiagnosticLogSettings)) + { + writer.WritePropertyName("diagnosticLogSettings"); + writer.WriteObjectValue(DiagnosticLogSettings); + } + if (Optional.IsDefined(DisableLocalAuth)) + { + writer.WritePropertyName("disableLocalAuth"); + writer.WriteBooleanValue(DisableLocalAuth.Value); + } + if (Optional.IsDefined(RestoreParameters)) + { + writer.WritePropertyName("restoreParameters"); + writer.WriteObjectValue(RestoreParameters); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -155,6 +212,7 @@ internal static DatabaseAccountCreateUpdateParameters DeserializeDatabaseAccount Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional consistencyPolicy = default; IList locations = default; string databaseAccountOfferType = default; @@ -168,11 +226,20 @@ internal static DatabaseAccountCreateUpdateParameters DeserializeDatabaseAccount Optional connectorOffer = default; Optional disableKeyBasedMetadataWriteAccess = default; Optional keyVaultKeyUri = default; + Optional defaultIdentity = default; Optional publicNetworkAccess = default; Optional enableFreeTier = default; Optional apiProperties = default; Optional enableAnalyticalStorage = default; + Optional analyticalStorageConfiguration = default; + CreateMode createMode = default; + Optional backupPolicy = default; Optional> cors = default; + Optional networkAclBypass = default; + Optional> networkAclBypassResourceIds = default; + Optional diagnosticLogSettings = default; + Optional disableLocalAuth = default; + Optional restoreParameters = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind")) @@ -220,6 +287,16 @@ internal static DatabaseAccountCreateUpdateParameters DeserializeDatabaseAccount tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -364,6 +441,11 @@ internal static DatabaseAccountCreateUpdateParameters DeserializeDatabaseAccount keyVaultKeyUri = property0.Value.GetString(); continue; } + if (property0.NameEquals("defaultIdentity")) + { + defaultIdentity = property0.Value.GetString(); + continue; + } if (property0.NameEquals("publicNetworkAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -404,6 +486,31 @@ internal static DatabaseAccountCreateUpdateParameters DeserializeDatabaseAccount enableAnalyticalStorage = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("analyticalStorageConfiguration")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + analyticalStorageConfiguration = AnalyticalStorageConfiguration.DeserializeAnalyticalStorageConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("createMode")) + { + createMode = new CreateMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("backupPolicy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + backupPolicy = BackupPolicy.DeserializeBackupPolicy(property0.Value); + continue; + } if (property0.NameEquals("cors")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -419,11 +526,66 @@ internal static DatabaseAccountCreateUpdateParameters DeserializeDatabaseAccount cors = array; continue; } + if (property0.NameEquals("networkAclBypass")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + networkAclBypass = property0.Value.GetString().ToNetworkAclBypass(); + continue; + } + if (property0.NameEquals("networkAclBypassResourceIds")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + networkAclBypassResourceIds = array; + continue; + } + if (property0.NameEquals("diagnosticLogSettings")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + diagnosticLogSettings = DiagnosticLogSettings.DeserializeDiagnosticLogSettings(property0.Value); + continue; + } + if (property0.NameEquals("disableLocalAuth")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + disableLocalAuth = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("restoreParameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + restoreParameters = RestoreParameters.DeserializeRestoreParameters(property0.Value); + continue; + } } continue; } } - return new DatabaseAccountCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), Optional.ToList(cors)); + return new DatabaseAccountCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, createMode, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), restoreParameters.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.cs index f1a1cdf2cb39..8a04dfe0bbf7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateParameters.cs @@ -17,8 +17,9 @@ public partial class DatabaseAccountCreateUpdateParameters : ARMResourceProperti { /// Initializes a new instance of DatabaseAccountCreateUpdateParameters. /// An array that contains the georeplication locations enabled for the Cosmos DB account. + /// Enum to indicate the mode of account creation. /// is null. - public DatabaseAccountCreateUpdateParameters(IEnumerable locations) + public DatabaseAccountCreateUpdateParameters(IEnumerable locations, CreateMode createMode) { if (locations == null) { @@ -30,7 +31,9 @@ public DatabaseAccountCreateUpdateParameters(IEnumerable locations) IpRules = new ChangeTrackingList(); Capabilities = new ChangeTrackingList(); VirtualNetworkRules = new ChangeTrackingList(); + CreateMode = createMode; Cors = new ChangeTrackingList(); + NetworkAclBypassResourceIds = new ChangeTrackingList(); } /// Initializes a new instance of DatabaseAccountCreateUpdateParameters. @@ -39,6 +42,7 @@ public DatabaseAccountCreateUpdateParameters(IEnumerable locations) /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// Indicates the type of database account. This can only be set at database account creation. /// The consistency policy for the Cosmos DB account. /// An array that contains the georeplication locations enabled for the Cosmos DB account. @@ -53,12 +57,21 @@ public DatabaseAccountCreateUpdateParameters(IEnumerable locations) /// The cassandra connector offer type for the Cosmos DB database C* account. /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. /// The URI of the key vault. + /// The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. /// Whether requests from Public Network are allowed. /// Flag to indicate whether Free Tier is enabled. /// API specific properties. Currently, supported only for MongoDB API. /// Flag to indicate whether to enable storage analytics. + /// Analytical storage specific properties. + /// Enum to indicate the mode of account creation. + /// The object representing the policy for taking backups on an account. /// The CORS policy for the Cosmos DB database account. - internal DatabaseAccountCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, DatabaseAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, string databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, PublicNetworkAccess? publicNetworkAccess, bool? enableFreeTier, ApiProperties apiProperties, bool? enableAnalyticalStorage, IList cors) : base(id, name, type, location, tags) + /// Indicates what services are allowed to bypass firewall checks. + /// An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + /// The Object representing the different Diagnostic log settings for the Cosmos DB Account. + /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + /// Parameters to indicate the information about the restore. + internal DatabaseAccountCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, DatabaseAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, string databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, string defaultIdentity, PublicNetworkAccess? publicNetworkAccess, bool? enableFreeTier, ApiProperties apiProperties, bool? enableAnalyticalStorage, AnalyticalStorageConfiguration analyticalStorageConfiguration, CreateMode createMode, BackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, RestoreParameters restoreParameters) : base(id, name, type, location, tags, identity) { Kind = kind; ConsistencyPolicy = consistencyPolicy; @@ -74,11 +87,20 @@ internal DatabaseAccountCreateUpdateParameters(string id, string name, string ty ConnectorOffer = connectorOffer; DisableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; KeyVaultKeyUri = keyVaultKeyUri; + DefaultIdentity = defaultIdentity; PublicNetworkAccess = publicNetworkAccess; EnableFreeTier = enableFreeTier; ApiProperties = apiProperties; EnableAnalyticalStorage = enableAnalyticalStorage; + AnalyticalStorageConfiguration = analyticalStorageConfiguration; + CreateMode = createMode; + BackupPolicy = backupPolicy; Cors = cors; + NetworkAclBypass = networkAclBypass; + NetworkAclBypassResourceIds = networkAclBypassResourceIds; + DiagnosticLogSettings = diagnosticLogSettings; + DisableLocalAuth = disableLocalAuth; + RestoreParameters = restoreParameters; } /// Indicates the type of database account. This can only be set at database account creation. @@ -109,15 +131,33 @@ internal DatabaseAccountCreateUpdateParameters(string id, string name, string ty public bool? DisableKeyBasedMetadataWriteAccess { get; set; } /// The URI of the key vault. public string KeyVaultKeyUri { get; set; } + /// The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + public string DefaultIdentity { get; set; } /// Whether requests from Public Network are allowed. - public PublicNetworkAccess? PublicNetworkAccess { get; } + public PublicNetworkAccess? PublicNetworkAccess { get; set; } /// Flag to indicate whether Free Tier is enabled. public bool? EnableFreeTier { get; set; } /// API specific properties. Currently, supported only for MongoDB API. public ApiProperties ApiProperties { get; set; } /// Flag to indicate whether to enable storage analytics. public bool? EnableAnalyticalStorage { get; set; } + /// Analytical storage specific properties. + public AnalyticalStorageConfiguration AnalyticalStorageConfiguration { get; set; } + /// Enum to indicate the mode of account creation. + internal CreateMode CreateMode { get; set; } + /// The object representing the policy for taking backups on an account. + public BackupPolicy BackupPolicy { get; set; } /// The CORS policy for the Cosmos DB database account. public IList Cors { get; } + /// Indicates what services are allowed to bypass firewall checks. + public NetworkAclBypass? NetworkAclBypass { get; set; } + /// An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + public IList NetworkAclBypassResourceIds { get; } + /// The Object representing the different Diagnostic log settings for the Cosmos DB Account. + public DiagnosticLogSettings DiagnosticLogSettings { get; set; } + /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + public bool? DisableLocalAuth { get; set; } + /// Parameters to indicate the information about the restore. + public RestoreParameters RestoreParameters { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..dc210c279943 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateProperties.Serialization.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class DatabaseAccountCreateUpdateProperties + { + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateProperties.cs new file mode 100644 index 000000000000..0840c4d92421 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountCreateUpdateProperties.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties to create and update Azure Cosmos DB database accounts. + internal partial class DatabaseAccountCreateUpdateProperties + { + /// Initializes a new instance of DatabaseAccountCreateUpdateProperties. + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + /// is null. + internal DatabaseAccountCreateUpdateProperties(IEnumerable locations) + { + if (locations == null) + { + throw new ArgumentNullException(nameof(locations)); + } + + Locations = locations.ToList(); + DatabaseAccountOfferType = "Standard"; + IpRules = new ChangeTrackingList(); + Capabilities = new ChangeTrackingList(); + VirtualNetworkRules = new ChangeTrackingList(); + Cors = new ChangeTrackingList(); + NetworkAclBypassResourceIds = new ChangeTrackingList(); + } + + /// The consistency policy for the Cosmos DB account. + public ConsistencyPolicy ConsistencyPolicy { get; } + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + public IReadOnlyList Locations { get; } + /// The offer type for the database. + public string DatabaseAccountOfferType { get; } + /// List of IpRules. + public IReadOnlyList IpRules { get; } + /// Flag to indicate whether to enable/disable Virtual Network ACL rules. + public bool? IsVirtualNetworkFilterEnabled { get; } + /// Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + public bool? EnableAutomaticFailover { get; } + /// List of Cosmos DB capabilities for the account. + public IReadOnlyList Capabilities { get; } + /// List of Virtual Network ACL rules configured for the Cosmos DB account. + public IReadOnlyList VirtualNetworkRules { get; } + /// Enables the account to write in multiple locations. + public bool? EnableMultipleWriteLocations { get; } + /// Enables the cassandra connector on the Cosmos DB C* account. + public bool? EnableCassandraConnector { get; } + /// The cassandra connector offer type for the Cosmos DB database C* account. + public ConnectorOffer? ConnectorOffer { get; } + /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. + public bool? DisableKeyBasedMetadataWriteAccess { get; } + /// The URI of the key vault. + public string KeyVaultKeyUri { get; } + /// The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + public string DefaultIdentity { get; } + /// Whether requests from Public Network are allowed. + public PublicNetworkAccess? PublicNetworkAccess { get; } + /// Flag to indicate whether Free Tier is enabled. + public bool? EnableFreeTier { get; } + /// API specific properties. Currently, supported only for MongoDB API. + public ApiProperties ApiProperties { get; } + /// Flag to indicate whether to enable storage analytics. + public bool? EnableAnalyticalStorage { get; } + /// Analytical storage specific properties. + public AnalyticalStorageConfiguration AnalyticalStorageConfiguration { get; } + /// Enum to indicate the mode of account creation. + internal CreateMode CreateMode { get; set; } + /// The object representing the policy for taking backups on an account. + public BackupPolicy BackupPolicy { get; } + /// The CORS policy for the Cosmos DB database account. + public IReadOnlyList Cors { get; } + /// Indicates what services are allowed to bypass firewall checks. + public NetworkAclBypass? NetworkAclBypass { get; } + /// An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + public IReadOnlyList NetworkAclBypassResourceIds { get; } + /// The Object representing the different Diagnostic log settings for the Cosmos DB Account. + public DiagnosticLogSettings DiagnosticLogSettings { get; } + /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + public bool? DisableLocalAuth { get; } + /// Parameters to indicate the information about the restore. + public RestoreParameters RestoreParameters { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.Serialization.cs index 010158e41907..37e66857b2ed 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.Serialization.cs @@ -37,6 +37,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(IpRules)) @@ -109,6 +114,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyVaultKeyUri"); writer.WriteStringValue(KeyVaultKeyUri); } + if (Optional.IsDefined(DefaultIdentity)) + { + writer.WritePropertyName("defaultIdentity"); + writer.WriteStringValue(DefaultIdentity); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } if (Optional.IsDefined(EnableFreeTier)) { writer.WritePropertyName("enableFreeTier"); @@ -124,6 +139,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableAnalyticalStorage"); writer.WriteBooleanValue(EnableAnalyticalStorage.Value); } + if (Optional.IsDefined(AnalyticalStorageConfiguration)) + { + writer.WritePropertyName("analyticalStorageConfiguration"); + writer.WriteObjectValue(AnalyticalStorageConfiguration); + } + if (Optional.IsDefined(CreateMode)) + { + writer.WritePropertyName("createMode"); + writer.WriteStringValue(CreateMode.Value.ToString()); + } + if (Optional.IsDefined(RestoreParameters)) + { + writer.WritePropertyName("restoreParameters"); + writer.WriteObjectValue(RestoreParameters); + } + if (Optional.IsDefined(BackupPolicy)) + { + writer.WritePropertyName("backupPolicy"); + writer.WriteObjectValue(BackupPolicy); + } if (Optional.IsCollectionDefined(Cors)) { writer.WritePropertyName("cors"); @@ -134,6 +169,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(NetworkAclBypass)) + { + writer.WritePropertyName("networkAclBypass"); + writer.WriteStringValue(NetworkAclBypass.Value.ToSerialString()); + } + if (Optional.IsCollectionDefined(NetworkAclBypassResourceIds)) + { + writer.WritePropertyName("networkAclBypassResourceIds"); + writer.WriteStartArray(); + foreach (var item in NetworkAclBypassResourceIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DiagnosticLogSettings)) + { + writer.WritePropertyName("diagnosticLogSettings"); + writer.WriteObjectValue(DiagnosticLogSettings); + } + if (Optional.IsDefined(DisableLocalAuth)) + { + writer.WritePropertyName("disableLocalAuth"); + writer.WriteBooleanValue(DisableLocalAuth.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -141,11 +201,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(JsonElement element) { Optional kind = default; + Optional systemData = default; Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional provisioningState = default; Optional documentEndpoint = default; Optional databaseAccountOfferType = default; @@ -165,11 +227,21 @@ internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(J Optional connectorOffer = default; Optional disableKeyBasedMetadataWriteAccess = default; Optional keyVaultKeyUri = default; + Optional defaultIdentity = default; Optional publicNetworkAccess = default; Optional enableFreeTier = default; Optional apiProperties = default; Optional enableAnalyticalStorage = default; + Optional analyticalStorageConfiguration = default; + Optional instanceId = default; + Optional createMode = default; + Optional restoreParameters = default; + Optional backupPolicy = default; Optional> cors = default; + Optional networkAclBypass = default; + Optional> networkAclBypassResourceIds = default; + Optional diagnosticLogSettings = default; + Optional disableLocalAuth = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind")) @@ -182,6 +254,16 @@ internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(J kind = new DatabaseAccountKind(property.Value.GetString()); continue; } + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = SystemData.DeserializeSystemData(property.Value); + continue; + } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -217,6 +299,16 @@ internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(J tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -436,6 +528,11 @@ internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(J keyVaultKeyUri = property0.Value.GetString(); continue; } + if (property0.NameEquals("defaultIdentity")) + { + defaultIdentity = property0.Value.GetString(); + continue; + } if (property0.NameEquals("publicNetworkAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -476,6 +573,51 @@ internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(J enableAnalyticalStorage = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("analyticalStorageConfiguration")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + analyticalStorageConfiguration = AnalyticalStorageConfiguration.DeserializeAnalyticalStorageConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("instanceId")) + { + instanceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("createMode")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + createMode = new CreateMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("restoreParameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + restoreParameters = RestoreParameters.DeserializeRestoreParameters(property0.Value); + continue; + } + if (property0.NameEquals("backupPolicy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + backupPolicy = BackupPolicy.DeserializeBackupPolicy(property0.Value); + continue; + } if (property0.NameEquals("cors")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -491,11 +633,56 @@ internal static DatabaseAccountGetResults DeserializeDatabaseAccountGetResults(J cors = array; continue; } + if (property0.NameEquals("networkAclBypass")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + networkAclBypass = property0.Value.GetString().ToNetworkAclBypass(); + continue; + } + if (property0.NameEquals("networkAclBypassResourceIds")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + networkAclBypassResourceIds = array; + continue; + } + if (property0.NameEquals("diagnosticLogSettings")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + diagnosticLogSettings = DiagnosticLogSettings.DeserializeDiagnosticLogSettings(property0.Value); + continue; + } + if (property0.NameEquals("disableLocalAuth")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + disableLocalAuth = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new DatabaseAccountGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, databaseAccountOfferType.Value, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), Optional.ToList(cors)); + return new DatabaseAccountGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, Optional.ToNullable(kind), systemData.Value, provisioningState.Value, documentEndpoint.Value, databaseAccountOfferType.Value, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, instanceId.Value, Optional.ToNullable(createMode), restoreParameters.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth)); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.cs index a0db189203ed..f91c81c9cc05 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountGetResults.cs @@ -26,6 +26,7 @@ public DatabaseAccountGetResults() VirtualNetworkRules = new ChangeTrackingList(); PrivateEndpointConnections = new ChangeTrackingList(); Cors = new ChangeTrackingList(); + NetworkAclBypassResourceIds = new ChangeTrackingList(); } /// Initializes a new instance of DatabaseAccountGetResults. @@ -34,7 +35,9 @@ public DatabaseAccountGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// Indicates the type of database account. This can only be set at database account creation. + /// The system meta data relating to this resource. /// The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. /// The connection endpoint for the Cosmos DB database account. /// The offer type for the Cosmos DB database account. Default value: Standard. @@ -54,14 +57,25 @@ public DatabaseAccountGetResults() /// The cassandra connector offer type for the Cosmos DB database C* account. /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. /// The URI of the key vault. + /// The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. /// Whether requests from Public Network are allowed. /// Flag to indicate whether Free Tier is enabled. /// API specific properties. /// Flag to indicate whether to enable storage analytics. + /// Analytical storage specific properties. + /// A unique identifier assigned to the database account. + /// Enum to indicate the mode of account creation. + /// Parameters to indicate the information about the restore. + /// The object representing the policy for taking backups on an account. /// The CORS policy for the Cosmos DB database account. - internal DatabaseAccountGetResults(string id, string name, string type, string location, IDictionary tags, DatabaseAccountKind? kind, string provisioningState, string documentEndpoint, string databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, PublicNetworkAccess? publicNetworkAccess, bool? enableFreeTier, ApiProperties apiProperties, bool? enableAnalyticalStorage, IList cors) : base(id, name, type, location, tags) + /// Indicates what services are allowed to bypass firewall checks. + /// An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + /// The Object representing the different Diagnostic log settings for the Cosmos DB Account. + /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + internal DatabaseAccountGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, DatabaseAccountKind? kind, SystemData systemData, string provisioningState, string documentEndpoint, string databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, string keyVaultKeyUri, string defaultIdentity, PublicNetworkAccess? publicNetworkAccess, bool? enableFreeTier, ApiProperties apiProperties, bool? enableAnalyticalStorage, AnalyticalStorageConfiguration analyticalStorageConfiguration, string instanceId, CreateMode? createMode, RestoreParameters restoreParameters, BackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth) : base(id, name, type, location, tags, identity) { Kind = kind; + SystemData = systemData; ProvisioningState = provisioningState; DocumentEndpoint = documentEndpoint; DatabaseAccountOfferType = databaseAccountOfferType; @@ -81,15 +95,27 @@ internal DatabaseAccountGetResults(string id, string name, string type, string l ConnectorOffer = connectorOffer; DisableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; KeyVaultKeyUri = keyVaultKeyUri; + DefaultIdentity = defaultIdentity; PublicNetworkAccess = publicNetworkAccess; EnableFreeTier = enableFreeTier; ApiProperties = apiProperties; EnableAnalyticalStorage = enableAnalyticalStorage; + AnalyticalStorageConfiguration = analyticalStorageConfiguration; + InstanceId = instanceId; + CreateMode = createMode; + RestoreParameters = restoreParameters; + BackupPolicy = backupPolicy; Cors = cors; + NetworkAclBypass = networkAclBypass; + NetworkAclBypassResourceIds = networkAclBypassResourceIds; + DiagnosticLogSettings = diagnosticLogSettings; + DisableLocalAuth = disableLocalAuth; } /// Indicates the type of database account. This can only be set at database account creation. public DatabaseAccountKind? Kind { get; set; } + /// The system meta data relating to this resource. + public SystemData SystemData { get; } /// The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. public string ProvisioningState { get; } /// The connection endpoint for the Cosmos DB database account. @@ -128,15 +154,35 @@ internal DatabaseAccountGetResults(string id, string name, string type, string l public bool? DisableKeyBasedMetadataWriteAccess { get; set; } /// The URI of the key vault. public string KeyVaultKeyUri { get; set; } + /// The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + public string DefaultIdentity { get; set; } /// Whether requests from Public Network are allowed. - public PublicNetworkAccess? PublicNetworkAccess { get; } + public PublicNetworkAccess? PublicNetworkAccess { get; set; } /// Flag to indicate whether Free Tier is enabled. public bool? EnableFreeTier { get; set; } /// API specific properties. public ApiProperties ApiProperties { get; set; } /// Flag to indicate whether to enable storage analytics. public bool? EnableAnalyticalStorage { get; set; } + /// Analytical storage specific properties. + public AnalyticalStorageConfiguration AnalyticalStorageConfiguration { get; set; } + /// A unique identifier assigned to the database account. + public string InstanceId { get; } + /// Enum to indicate the mode of account creation. + public CreateMode? CreateMode { get; set; } + /// Parameters to indicate the information about the restore. + public RestoreParameters RestoreParameters { get; set; } + /// The object representing the policy for taking backups on an account. + public BackupPolicy BackupPolicy { get; set; } /// The CORS policy for the Cosmos DB database account. public IList Cors { get; } + /// Indicates what services are allowed to bypass firewall checks. + public NetworkAclBypass? NetworkAclBypass { get; set; } + /// An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + public IList NetworkAclBypassResourceIds { get; } + /// The Object representing the different Diagnostic log settings for the Cosmos DB Account. + public DiagnosticLogSettings DiagnosticLogSettings { get; set; } + /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + public bool? DisableLocalAuth { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.Serialization.cs index a5d8cee46b21..8cfc065c9b8b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.Serialization.cs @@ -31,6 +31,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"); writer.WriteStringValue(Location); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ConsistencyPolicy)) @@ -113,6 +118,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyVaultKeyUri"); writer.WriteStringValue(KeyVaultKeyUri); } + if (Optional.IsDefined(DefaultIdentity)) + { + writer.WritePropertyName("defaultIdentity"); + writer.WriteStringValue(DefaultIdentity); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } if (Optional.IsDefined(EnableFreeTier)) { writer.WritePropertyName("enableFreeTier"); @@ -128,6 +143,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableAnalyticalStorage"); writer.WriteBooleanValue(EnableAnalyticalStorage.Value); } + if (Optional.IsDefined(AnalyticalStorageConfiguration)) + { + writer.WritePropertyName("analyticalStorageConfiguration"); + writer.WriteObjectValue(AnalyticalStorageConfiguration); + } + if (Optional.IsDefined(BackupPolicy)) + { + writer.WritePropertyName("backupPolicy"); + writer.WriteObjectValue(BackupPolicy); + } if (Optional.IsCollectionDefined(Cors)) { writer.WritePropertyName("cors"); @@ -138,6 +163,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(NetworkAclBypass)) + { + writer.WritePropertyName("networkAclBypass"); + writer.WriteStringValue(NetworkAclBypass.Value.ToSerialString()); + } + if (Optional.IsCollectionDefined(NetworkAclBypassResourceIds)) + { + writer.WritePropertyName("networkAclBypassResourceIds"); + writer.WriteStartArray(); + foreach (var item in NetworkAclBypassResourceIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DiagnosticLogSettings)) + { + writer.WritePropertyName("diagnosticLogSettings"); + writer.WriteObjectValue(DiagnosticLogSettings); + } + if (Optional.IsDefined(DisableLocalAuth)) + { + writer.WritePropertyName("disableLocalAuth"); + writer.WriteBooleanValue(DisableLocalAuth.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.cs index 5d24ee0823c3..2e01e416ae08 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountUpdateParameters.cs @@ -22,12 +22,15 @@ public DatabaseAccountUpdateParameters() Capabilities = new ChangeTrackingList(); VirtualNetworkRules = new ChangeTrackingList(); Cors = new ChangeTrackingList(); + NetworkAclBypassResourceIds = new ChangeTrackingList(); } /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". public IDictionary Tags { get; } /// The location of the resource group to which the resource belongs. public string Location { get; set; } + /// Identity for the resource. + public ManagedServiceIdentity Identity { get; set; } /// The consistency policy for the Cosmos DB account. public ConsistencyPolicy ConsistencyPolicy { get; set; } /// An array that contains the georeplication locations enabled for the Cosmos DB account. @@ -52,15 +55,29 @@ public DatabaseAccountUpdateParameters() public bool? DisableKeyBasedMetadataWriteAccess { get; set; } /// The URI of the key vault. public string KeyVaultKeyUri { get; set; } + /// The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + public string DefaultIdentity { get; set; } /// Whether requests from Public Network are allowed. - public PublicNetworkAccess? PublicNetworkAccess { get; } + public PublicNetworkAccess? PublicNetworkAccess { get; set; } /// Flag to indicate whether Free Tier is enabled. public bool? EnableFreeTier { get; set; } /// API specific properties. Currently, supported only for MongoDB API. public ApiProperties ApiProperties { get; set; } /// Flag to indicate whether to enable storage analytics. public bool? EnableAnalyticalStorage { get; set; } + /// Analytical storage specific properties. + public AnalyticalStorageConfiguration AnalyticalStorageConfiguration { get; set; } + /// The object representing the policy for taking backups on an account. + public BackupPolicy BackupPolicy { get; set; } /// The CORS policy for the Cosmos DB database account. public IList Cors { get; } + /// Indicates what services are allowed to bypass firewall checks. + public NetworkAclBypass? NetworkAclBypass { get; set; } + /// An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + public IList NetworkAclBypassResourceIds { get; } + /// The Object representing the different Diagnostic log settings for the Cosmos DB Account. + public DiagnosticLogSettings DiagnosticLogSettings { get; set; } + /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + public bool? DisableLocalAuth { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResource.Serialization.cs new file mode 100644 index 000000000000..f667bf7d564c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResource.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DatabaseRestoreResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DatabaseName)) + { + writer.WritePropertyName("databaseName"); + writer.WriteStringValue(DatabaseName); + } + if (Optional.IsCollectionDefined(CollectionNames)) + { + writer.WritePropertyName("collectionNames"); + writer.WriteStartArray(); + foreach (var item in CollectionNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static DatabaseRestoreResource DeserializeDatabaseRestoreResource(JsonElement element) + { + Optional databaseName = default; + Optional> collectionNames = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("databaseName")) + { + databaseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("collectionNames")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + collectionNames = array; + continue; + } + } + return new DatabaseRestoreResource(databaseName.Value, Optional.ToList(collectionNames)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResource.cs new file mode 100644 index 000000000000..f59670d41ef6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Specific Databases to restore. + public partial class DatabaseRestoreResource + { + /// Initializes a new instance of DatabaseRestoreResource. + public DatabaseRestoreResource() + { + CollectionNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseRestoreResource. + /// The name of the database available for restore. + /// The names of the collections available for restore. + internal DatabaseRestoreResource(string databaseName, IList collectionNames) + { + DatabaseName = databaseName; + CollectionNames = collectionNames; + } + + /// The name of the database available for restore. + public string DatabaseName { get; set; } + /// The names of the collections available for restore. + public IList CollectionNames { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultRequestDatabaseAccountCreateUpdateProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultRequestDatabaseAccountCreateUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..6c1b3224c9c6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultRequestDatabaseAccountCreateUpdateProperties.Serialization.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class DefaultRequestDatabaseAccountCreateUpdateProperties + { + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultRequestDatabaseAccountCreateUpdateProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultRequestDatabaseAccountCreateUpdateProperties.cs new file mode 100644 index 000000000000..eef62e76b9ec --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultRequestDatabaseAccountCreateUpdateProperties.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties for non-restore Azure Cosmos DB database account requests. + internal partial class DefaultRequestDatabaseAccountCreateUpdateProperties : DatabaseAccountCreateUpdateProperties + { + /// Initializes a new instance of DefaultRequestDatabaseAccountCreateUpdateProperties. + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + /// is null. + internal DefaultRequestDatabaseAccountCreateUpdateProperties(IEnumerable locations) : base(locations) + { + if (locations == null) + { + throw new ArgumentNullException(nameof(locations)); + } + + CreateMode = CreateMode.Default; + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.Serialization.cs new file mode 100644 index 000000000000..553257c74584 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.Serialization.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class DiagnosticLogSettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(EnableFullTextQuery)) + { + writer.WritePropertyName("enableFullTextQuery"); + writer.WriteStringValue(EnableFullTextQuery.Value.ToSerialString()); + } + writer.WriteEndObject(); + } + + internal static DiagnosticLogSettings DeserializeDiagnosticLogSettings(JsonElement element) + { + Optional enableFullTextQuery = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enableFullTextQuery")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + enableFullTextQuery = property.Value.GetString().ToEnableFullTextQuery(); + continue; + } + } + return new DiagnosticLogSettings(Optional.ToNullable(enableFullTextQuery)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.cs new file mode 100644 index 000000000000..5eebfbd24e00 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates what diagnostic log settings are to be enabled. + public partial class DiagnosticLogSettings + { + /// Initializes a new instance of DiagnosticLogSettings. + public DiagnosticLogSettings() + { + } + + /// Initializes a new instance of DiagnosticLogSettings. + /// Describe the level of detail with which queries are to be logged. + internal DiagnosticLogSettings(EnableFullTextQuery? enableFullTextQuery) + { + EnableFullTextQuery = enableFullTextQuery; + } + + /// Describe the level of detail with which queries are to be logged. + public EnableFullTextQuery? EnableFullTextQuery { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/EnableFullTextQuery.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/EnableFullTextQuery.Serialization.cs new file mode 100644 index 000000000000..a9491285d82c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/EnableFullTextQuery.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal static partial class EnableFullTextQueryExtensions + { + public static string ToSerialString(this EnableFullTextQuery value) => value switch + { + EnableFullTextQuery.None => "None", + EnableFullTextQuery.True => "True", + EnableFullTextQuery.False => "False", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown EnableFullTextQuery value.") + }; + + public static EnableFullTextQuery ToEnableFullTextQuery(this string value) + { + if (string.Equals(value, "None", StringComparison.InvariantCultureIgnoreCase)) return EnableFullTextQuery.None; + if (string.Equals(value, "True", StringComparison.InvariantCultureIgnoreCase)) return EnableFullTextQuery.True; + if (string.Equals(value, "False", StringComparison.InvariantCultureIgnoreCase)) return EnableFullTextQuery.False; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown EnableFullTextQuery value."); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/EnableFullTextQuery.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/EnableFullTextQuery.cs new file mode 100644 index 000000000000..e851f23ff12e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/EnableFullTextQuery.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describe the level of detail with which queries are to be logged. + public enum EnableFullTextQuery + { + /// None. + None, + /// True. + True, + /// False. + False + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.Serialization.cs index 6054fe653579..e29e623896a6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.Serialization.cs @@ -21,7 +21,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ExtendedResourceProperties DeserializeExtendedResourceProperties(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; foreach (var property in element.EnumerateObject()) { @@ -37,7 +37,7 @@ internal static ExtendedResourceProperties DeserializeExtendedResourceProperties property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -46,7 +46,7 @@ internal static ExtendedResourceProperties DeserializeExtendedResourceProperties continue; } } - return new ExtendedResourceProperties(Rid.Value, Ts.Value, Etag.Value); + return new ExtendedResourceProperties(Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.cs index 4eff6559532b..ba25be86ee41 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedResourceProperties.cs @@ -19,7 +19,7 @@ public ExtendedResourceProperties() /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedResourceProperties(string rid, object ts, string etag) + internal ExtendedResourceProperties(string rid, float? ts, string etag) { Rid = rid; Ts = ts; @@ -29,7 +29,7 @@ internal ExtendedResourceProperties(string rid, object ts, string etag) /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeRegionalServiceResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeRegionalServiceResource.Serialization.cs new file mode 100644 index 000000000000..5ee4a3058ec5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeRegionalServiceResource.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GraphAPIComputeRegionalServiceResource + { + internal static GraphAPIComputeRegionalServiceResource DeserializeGraphAPIComputeRegionalServiceResource(JsonElement element) + { + Optional graphApiComputeEndpoint = default; + Optional name = default; + Optional location = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("graphApiComputeEndpoint")) + { + graphApiComputeEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new ServiceStatus(property.Value.GetString()); + continue; + } + } + return new GraphAPIComputeRegionalServiceResource(name.Value, location.Value, Optional.ToNullable(status), graphApiComputeEndpoint.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeRegionalServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeRegionalServiceResource.cs new file mode 100644 index 000000000000..c85660efc16e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeRegionalServiceResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Resource for a regional service location. + public partial class GraphAPIComputeRegionalServiceResource : RegionalServiceResource + { + /// Initializes a new instance of GraphAPIComputeRegionalServiceResource. + internal GraphAPIComputeRegionalServiceResource() + { + } + + /// Initializes a new instance of GraphAPIComputeRegionalServiceResource. + /// The regional service name. + /// The location name. + /// Describes the status of a service. + /// The regional endpoint for GraphAPICompute. + internal GraphAPIComputeRegionalServiceResource(string name, string location, ServiceStatus? status, string graphApiComputeEndpoint) : base(name, location, status) + { + GraphApiComputeEndpoint = graphApiComputeEndpoint; + } + + /// The regional endpoint for GraphAPICompute. + public string GraphApiComputeEndpoint { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResource.cs new file mode 100644 index 000000000000..4a00d10016d7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResource.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the service response property for GraphAPICompute. + internal partial class GraphAPIComputeServiceResource + { + /// Initializes a new instance of GraphAPIComputeServiceResource. + internal GraphAPIComputeServiceResource() + { + } + + /// Properties for GraphAPIComputeServiceResource. + public GraphAPIComputeServiceResourceProperties Properties { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResourceProperties.Serialization.cs new file mode 100644 index 000000000000..bdc5c319e6b3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResourceProperties.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GraphAPIComputeServiceResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(GraphApiComputeEndpoint)) + { + writer.WritePropertyName("graphApiComputeEndpoint"); + writer.WriteStringValue(GraphApiComputeEndpoint); + } + if (Optional.IsDefined(InstanceSize)) + { + writer.WritePropertyName("instanceSize"); + writer.WriteStringValue(InstanceSize.Value.ToString()); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"); + writer.WriteNumberValue(InstanceCount.Value); + } + writer.WritePropertyName("serviceType"); + writer.WriteStringValue(ServiceType.ToString()); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + + internal static GraphAPIComputeServiceResourceProperties DeserializeGraphAPIComputeServiceResourceProperties(JsonElement element) + { + Optional graphApiComputeEndpoint = default; + Optional> locations = default; + Optional creationTime = default; + Optional instanceSize = default; + Optional instanceCount = default; + ServiceType serviceType = default; + Optional status = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("graphApiComputeEndpoint")) + { + graphApiComputeEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("locations")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GraphAPIComputeRegionalServiceResource.DeserializeGraphAPIComputeRegionalServiceResource(item)); + } + locations = array; + continue; + } + if (property.NameEquals("creationTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("instanceSize")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + instanceSize = new ServiceSize(property.Value.GetString()); + continue; + } + if (property.NameEquals("instanceCount")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + instanceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("serviceType")) + { + serviceType = new ServiceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new ServiceStatus(property.Value.GetString()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); + } + additionalProperties = additionalPropertiesDictionary; + return new GraphAPIComputeServiceResourceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties, graphApiComputeEndpoint.Value, Optional.ToList(locations)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResourceProperties.cs new file mode 100644 index 000000000000..ee4e229afb87 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphAPIComputeServiceResourceProperties.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties for GraphAPIComputeServiceResource. + public partial class GraphAPIComputeServiceResourceProperties : ServiceResourceProperties + { + /// Initializes a new instance of GraphAPIComputeServiceResourceProperties. + public GraphAPIComputeServiceResourceProperties() + { + Locations = new ChangeTrackingList(); + ServiceType = ServiceType.GraphAPICompute; + } + + /// Initializes a new instance of GraphAPIComputeServiceResourceProperties. + /// Time of the last state change (ISO-8601 format). + /// Instance type for the service. + /// Instance count for the service. + /// ServiceType for the service. + /// Describes the status of a service. + /// . + /// GraphAPICompute endpoint for the service. + /// An array that contains all of the locations for the service. + internal GraphAPIComputeServiceResourceProperties(DateTimeOffset? creationTime, ServiceSize? instanceSize, int? instanceCount, ServiceType serviceType, ServiceStatus? status, IDictionary additionalProperties, string graphApiComputeEndpoint, IReadOnlyList locations) : base(creationTime, instanceSize, instanceCount, serviceType, status, additionalProperties) + { + GraphApiComputeEndpoint = graphApiComputeEndpoint; + Locations = locations; + ServiceType = serviceType; + } + + /// GraphAPICompute endpoint for the service. + public string GraphApiComputeEndpoint { get; set; } + /// An array that contains all of the locations for the service. + public IReadOnlyList Locations { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResource.Serialization.cs new file mode 100644 index 000000000000..0e7fa4aec9c7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResource.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GraphResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static GraphResource DeserializeGraphResource(JsonElement element) + { + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new GraphResource(id); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResource.cs new file mode 100644 index 000000000000..cae625cf2fe0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB Graph resource object. + public partial class GraphResource + { + /// Initializes a new instance of GraphResource. + /// Name of the Cosmos DB Graph. + /// is null. + public GraphResource(string id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; + } + + /// Name of the Cosmos DB Graph. + public string Id { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..794a198290c3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceCreateUpdateParameters.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GraphResourceCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static GraphResourceCreateUpdateParameters DeserializeGraphResourceCreateUpdateParameters(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional identity = default; + GraphResource resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + resource = GraphResource.DeserializeGraphResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); + continue; + } + } + continue; + } + } + return new GraphResourceCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceCreateUpdateParameters.cs new file mode 100644 index 000000000000..4677ac9050b5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceCreateUpdateParameters.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update Cosmos DB Graph resource. + public partial class GraphResourceCreateUpdateParameters : ARMResourceProperties + { + /// Initializes a new instance of GraphResourceCreateUpdateParameters. + /// The standard JSON format of a Graph resource. + /// is null. + public GraphResourceCreateUpdateParameters(GraphResource resource) + { + if (resource == null) + { + throw new ArgumentNullException(nameof(resource)); + } + + Resource = resource; + } + + /// Initializes a new instance of GraphResourceCreateUpdateParameters. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. + /// The standard JSON format of a Graph resource. + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + internal GraphResourceCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, GraphResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) + { + Resource = resource; + Options = options; + } + + /// The standard JSON format of a Graph resource. + public GraphResource Resource { get; set; } + /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + public CreateUpdateOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.Serialization.cs new file mode 100644 index 000000000000..fd1b624a9b7c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GraphResourceGetPropertiesOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Throughput)) + { + writer.WritePropertyName("throughput"); + writer.WriteNumberValue(Throughput.Value); + } + if (Optional.IsDefined(AutoscaleSettings)) + { + writer.WritePropertyName("autoscaleSettings"); + writer.WriteObjectValue(AutoscaleSettings); + } + writer.WriteEndObject(); + } + + internal static GraphResourceGetPropertiesOptions DeserializeGraphResourceGetPropertiesOptions(JsonElement element) + { + Optional throughput = default; + Optional autoscaleSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("throughput")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + throughput = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("autoscaleSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); + continue; + } + } + return new GraphResourceGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.cs new file mode 100644 index 000000000000..045f30d45117 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The GraphResourceGetPropertiesOptions. + public partial class GraphResourceGetPropertiesOptions : OptionsResource + { + /// Initializes a new instance of GraphResourceGetPropertiesOptions. + public GraphResourceGetPropertiesOptions() + { + } + + /// Initializes a new instance of GraphResourceGetPropertiesOptions. + /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. + /// Specifies the Autoscale settings. + internal GraphResourceGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + { + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..01ab87c8bd6c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesResource.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GraphResourceGetPropertiesResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static GraphResourceGetPropertiesResource DeserializeGraphResourceGetPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Ts = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new GraphResourceGetPropertiesResource(id, Rid.Value, Optional.ToNullable(Ts), Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesResource.cs new file mode 100644 index 000000000000..626a942d8097 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The GraphResourceGetPropertiesResource. + public partial class GraphResourceGetPropertiesResource : GraphResource + { + /// Initializes a new instance of GraphResourceGetPropertiesResource. + /// Name of the Cosmos DB Graph. + /// is null. + public GraphResourceGetPropertiesResource(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of GraphResourceGetPropertiesResource. + /// Name of the Cosmos DB Graph. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + /// is null. + internal GraphResourceGetPropertiesResource(string id, string rid, float? ts, string etag) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public float? Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResults.Serialization.cs new file mode 100644 index 000000000000..08fc50c3e4d8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResults.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class GraphResourceGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"); + writer.WriteObjectValue(Resource); + } + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static GraphResourceGetResults DeserializeGraphResourceGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional> tags = default; + Optional identity = default; + Optional resource = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + resource = GraphResourceGetPropertiesResource.DeserializeGraphResourceGetPropertiesResource(property0.Value); + continue; + } + if (property0.NameEquals("options")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + options = GraphResourceGetPropertiesOptions.DeserializeGraphResourceGetPropertiesOptions(property0.Value); + continue; + } + } + continue; + } + } + return new GraphResourceGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResults.cs new file mode 100644 index 000000000000..e6c908626cef --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResults.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB Graph resource. + public partial class GraphResourceGetResults : ARMResourceProperties + { + /// Initializes a new instance of GraphResourceGetResults. + public GraphResourceGetResults() + { + } + + /// Initializes a new instance of GraphResourceGetResults. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. + /// . + /// . + internal GraphResourceGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, GraphResourceGetPropertiesResource resource, GraphResourceGetPropertiesOptions options) : base(id, name, type, location, tags, identity) + { + Resource = resource; + Options = options; + } + + public GraphResourceGetPropertiesResource Resource { get; set; } + public GraphResourceGetPropertiesOptions Options { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.Serialization.cs new file mode 100644 index 000000000000..30bd6059dd0b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class GraphResourcesListResult + { + internal static GraphResourcesListResult DeserializeGraphResourcesListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GraphResourceGetResults.DeserializeGraphResourceGetResults(item)); + } + value = array; + continue; + } + } + return new GraphResourcesListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.cs new file mode 100644 index 000000000000..5b5307e2f2fe --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the Graph resource and their properties. + internal partial class GraphResourcesListResult + { + /// Initializes a new instance of GraphResourcesListResult. + internal GraphResourcesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of GraphResourcesListResult. + /// List of Graph resource and their properties. + internal GraphResourcesListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Graph resource and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.Serialization.cs index 41954710e555..d8254e88fc55 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static GremlinDatabaseCreateUpdateParameters DeserializeGremlinDatabase Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; GremlinDatabaseResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static GremlinDatabaseCreateUpdateParameters DeserializeGremlinDatabase tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static GremlinDatabaseCreateUpdateParameters DeserializeGremlinDatabase } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static GremlinDatabaseCreateUpdateParameters DeserializeGremlinDatabase continue; } } - return new GremlinDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new GremlinDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.cs index c4e3232b1762..8813b4597ad0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class GremlinDatabaseCreateUpdateParameters : ARMResourceProperti { /// Initializes a new instance of GremlinDatabaseCreateUpdateParameters. /// The standard JSON format of a Gremlin database. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public GremlinDatabaseCreateUpdateParameters(GremlinDatabaseResource resource, CreateUpdateOptions options) + /// is null. + public GremlinDatabaseCreateUpdateParameters(GremlinDatabaseResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of GremlinDatabaseCreateUpdateParameters. @@ -38,9 +32,10 @@ public GremlinDatabaseCreateUpdateParameters(GremlinDatabaseResource resource, C /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a Gremlin database. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal GremlinDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, GremlinDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal GremlinDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, GremlinDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.Serialization.cs index fa8eb06568b0..ced58dc1efcc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.Serialization.cs @@ -23,7 +23,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static GremlinDatabaseGetPropertiesResource DeserializeGremlinDatabaseGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; foreach (var property in element.EnumerateObject()) @@ -40,7 +40,7 @@ internal static GremlinDatabaseGetPropertiesResource DeserializeGremlinDatabaseG property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -54,7 +54,7 @@ internal static GremlinDatabaseGetPropertiesResource DeserializeGremlinDatabaseG continue; } } - return new GremlinDatabaseGetPropertiesResource(id, Rid.Value, Ts.Value, Etag.Value); + return new GremlinDatabaseGetPropertiesResource(id, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.cs index a473d082cf52..3f858c7ac9aa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetPropertiesResource.cs @@ -29,7 +29,7 @@ public GremlinDatabaseGetPropertiesResource(string id) : base(id) /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. /// is null. - internal GremlinDatabaseGetPropertiesResource(string id, string rid, object ts, string etag) : base(id) + internal GremlinDatabaseGetPropertiesResource(string id, string rid, float? ts, string etag) : base(id) { if (id == null) { @@ -44,7 +44,7 @@ internal GremlinDatabaseGetPropertiesResource(string id, string rid, object ts, /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.Serialization.cs index 6f4d1d227b7e..ac032df4e117 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static GremlinDatabaseGetResults DeserializeGremlinDatabaseGetResults(J Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static GremlinDatabaseGetResults DeserializeGremlinDatabaseGetResults(J tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static GremlinDatabaseGetResults DeserializeGremlinDatabaseGetResults(J continue; } } - return new GremlinDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new GremlinDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.cs index 52507641840e..b1e1d7973c2b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseGetResults.cs @@ -23,9 +23,10 @@ public GremlinDatabaseGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal GremlinDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, GremlinDatabaseGetPropertiesResource resource, GremlinDatabaseGetPropertiesOptions options) : base(id, name, type, location, tags) + internal GremlinDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, GremlinDatabaseGetPropertiesResource resource, GremlinDatabaseGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.Serialization.cs index f9366da48282..c66c160bc9ce 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static GremlinGraphCreateUpdateParameters DeserializeGremlinGraphCreate Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; GremlinGraphResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static GremlinGraphCreateUpdateParameters DeserializeGremlinGraphCreate tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static GremlinGraphCreateUpdateParameters DeserializeGremlinGraphCreate } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static GremlinGraphCreateUpdateParameters DeserializeGremlinGraphCreate continue; } } - return new GremlinGraphCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new GremlinGraphCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.cs index c7e490aafdb3..34613e92a7ba 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class GremlinGraphCreateUpdateParameters : ARMResourceProperties { /// Initializes a new instance of GremlinGraphCreateUpdateParameters. /// The standard JSON format of a Gremlin graph. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public GremlinGraphCreateUpdateParameters(GremlinGraphResource resource, CreateUpdateOptions options) + /// is null. + public GremlinGraphCreateUpdateParameters(GremlinGraphResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of GremlinGraphCreateUpdateParameters. @@ -38,9 +32,10 @@ public GremlinGraphCreateUpdateParameters(GremlinGraphResource resource, CreateU /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a Gremlin graph. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal GremlinGraphCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, GremlinGraphResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal GremlinGraphCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, GremlinGraphResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.Serialization.cs index 2397bc0ce644..1031d0b146af 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.Serialization.cs @@ -48,7 +48,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static GremlinGraphGetPropertiesResource DeserializeGremlinGraphGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; Optional indexingPolicy = default; @@ -70,7 +70,7 @@ internal static GremlinGraphGetPropertiesResource DeserializeGremlinGraphGetProp property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -134,7 +134,7 @@ internal static GremlinGraphGetPropertiesResource DeserializeGremlinGraphGetProp continue; } } - return new GremlinGraphGetPropertiesResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Rid.Value, Ts.Value, Etag.Value); + return new GremlinGraphGetPropertiesResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.cs index 86fedb392bfe..f1d6a26d5d66 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetPropertiesResource.cs @@ -33,7 +33,7 @@ public GremlinGraphGetPropertiesResource(string id) : base(id) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal GremlinGraphGetPropertiesResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, string rid, object ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy) + internal GremlinGraphGetPropertiesResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, string rid, float? ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy) { Rid = rid; Ts = ts; @@ -43,7 +43,7 @@ internal GremlinGraphGetPropertiesResource(string id, IndexingPolicy indexingPol /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.Serialization.cs index 66fb69a4ed9b..51027c2b45c0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static GremlinGraphGetResults DeserializeGremlinGraphGetResults(JsonEle Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static GremlinGraphGetResults DeserializeGremlinGraphGetResults(JsonEle tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static GremlinGraphGetResults DeserializeGremlinGraphGetResults(JsonEle continue; } } - return new GremlinGraphGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new GremlinGraphGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.cs index 11c8c4ed75a1..5e1973476634 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphGetResults.cs @@ -23,9 +23,10 @@ public GremlinGraphGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal GremlinGraphGetResults(string id, string name, string type, string location, IDictionary tags, GremlinGraphGetPropertiesResource resource, GremlinGraphGetPropertiesOptions options) : base(id, name, type, location, tags) + internal GremlinGraphGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, GremlinGraphGetPropertiesResource resource, GremlinGraphGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingMode.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingMode.cs index 8a13d561f11b..b59776600156 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingMode.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/IndexingMode.cs @@ -22,15 +22,15 @@ public IndexingMode(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string ConsistentValue = "Consistent"; - private const string LazyValue = "Lazy"; - private const string NoneValue = "None"; + private const string ConsistentValue = "consistent"; + private const string LazyValue = "lazy"; + private const string NoneValue = "none"; - /// Consistent. + /// consistent. public static IndexingMode Consistent { get; } = new IndexingMode(ConsistentValue); - /// Lazy. + /// lazy. public static IndexingMode Lazy { get; } = new IndexingMode(LazyValue); - /// None. + /// none. public static IndexingMode None { get; } = new IndexingMode(NoneValue); /// Determines if two values are the same. public static bool operator ==(IndexingMode left, IndexingMode right) => left.Equals(right); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs new file mode 100644 index 000000000000..b45662fd16cb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class ListBackups + { + internal static ListBackups DeserializeListBackups(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BackupResource.DeserializeBackupResource(item)); + } + value = array; + continue; + } + } + return new ListBackups(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs new file mode 100644 index 000000000000..1df2369a8f28 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// List of restorable backups for a Cassandra cluster. + internal partial class ListBackups + { + /// Initializes a new instance of ListBackups. + internal ListBackups() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ListBackups. + /// Container for array of backups. + internal ListBackups(IReadOnlyList value) + { + Value = value; + } + + /// Container for array of backups. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListClusters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListClusters.Serialization.cs new file mode 100644 index 000000000000..fb81b6575fbd --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListClusters.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class ListClusters + { + internal static ListClusters DeserializeListClusters(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClusterResource.DeserializeClusterResource(item)); + } + value = array; + continue; + } + } + return new ListClusters(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListClusters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListClusters.cs new file mode 100644 index 000000000000..7abc72c025dc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListClusters.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// List of managed Cassandra clusters. + internal partial class ListClusters + { + /// Initializes a new instance of ListClusters. + internal ListClusters() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ListClusters. + /// Container for the array of clusters. + internal ListClusters(IReadOnlyList value) + { + Value = value; + } + + /// Container for the array of clusters. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListDataCenters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListDataCenters.Serialization.cs new file mode 100644 index 000000000000..72ebf055b8f6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListDataCenters.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class ListDataCenters + { + internal static ListDataCenters DeserializeListDataCenters(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataCenterResource.DeserializeDataCenterResource(item)); + } + value = array; + continue; + } + } + return new ListDataCenters(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListDataCenters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListDataCenters.cs new file mode 100644 index 000000000000..ff9dba2faef5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListDataCenters.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// List of managed Cassandra data centers and their properties. + internal partial class ListDataCenters + { + /// Initializes a new instance of ListDataCenters. + internal ListDataCenters() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ListDataCenters. + /// Container for array of data centers. + internal ListDataCenters(IReadOnlyList value) + { + Value = value; + } + + /// Container for array of data centers. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationGetResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationGetResult.Serialization.cs new file mode 100644 index 000000000000..919cfd5ed26d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationGetResult.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class LocationGetResult : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static LocationGetResult DeserializeLocationGetResult(JsonElement element) + { + Optional properties = default; + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = LocationProperties.DeserializeLocationProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new LocationGetResult(id.Value, name.Value, type.Value, properties.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationGetResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationGetResult.cs new file mode 100644 index 000000000000..93f8cc61e4b0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationGetResult.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB location get result. + public partial class LocationGetResult : ARMProxyResource + { + /// Initializes a new instance of LocationGetResult. + public LocationGetResult() + { + } + + /// Initializes a new instance of LocationGetResult. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + /// Cosmos DB location metadata. + internal LocationGetResult(string id, string name, string type, LocationProperties properties) : base(id, name, type) + { + Properties = properties; + } + + /// Cosmos DB location metadata. + public LocationProperties Properties { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationListResult.Serialization.cs new file mode 100644 index 000000000000..c8bfbc4dca2c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class LocationListResult + { + internal static LocationListResult DeserializeLocationListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LocationGetResult.DeserializeLocationGetResult(item)); + } + value = array; + continue; + } + } + return new LocationListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationListResult.cs new file mode 100644 index 000000000000..bc1f89201214 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains Cosmos DB locations and their properties. + internal partial class LocationListResult + { + /// Initializes a new instance of LocationListResult. + internal LocationListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of LocationListResult. + /// List of Cosmos DB locations and their properties. + internal LocationListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Cosmos DB locations and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationProperties.Serialization.cs new file mode 100644 index 000000000000..47684b869395 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationProperties.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class LocationProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static LocationProperties DeserializeLocationProperties(JsonElement element) + { + Optional status = default; + Optional supportsAvailabilityZone = default; + Optional isResidencyRestricted = default; + Optional> backupStorageRedundancies = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status")) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("supportsAvailabilityZone")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + supportsAvailabilityZone = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("isResidencyRestricted")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + isResidencyRestricted = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("backupStorageRedundancies")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new BackupStorageRedundancy(item.GetString())); + } + backupStorageRedundancies = array; + continue; + } + } + return new LocationProperties(status.Value, Optional.ToNullable(supportsAvailabilityZone), Optional.ToNullable(isResidencyRestricted), Optional.ToList(backupStorageRedundancies)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationProperties.cs new file mode 100644 index 000000000000..1bb00c117f41 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/LocationProperties.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB location metadata. + public partial class LocationProperties + { + /// Initializes a new instance of LocationProperties. + public LocationProperties() + { + BackupStorageRedundancies = new ChangeTrackingList(); + } + + /// Initializes a new instance of LocationProperties. + /// The current status of location in Azure. + /// Flag indicating whether the location supports availability zones or not. + /// Flag indicating whether the location is residency sensitive. + /// The properties of available backup storage redundancies. + internal LocationProperties(string status, bool? supportsAvailabilityZone, bool? isResidencyRestricted, IReadOnlyList backupStorageRedundancies) + { + Status = status; + SupportsAvailabilityZone = supportsAvailabilityZone; + IsResidencyRestricted = isResidencyRestricted; + BackupStorageRedundancies = backupStorageRedundancies; + } + + /// The current status of location in Azure. + public string Status { get; } + /// Flag indicating whether the location supports availability zones or not. + public bool? SupportsAvailabilityZone { get; } + /// Flag indicating whether the location is residency sensitive. + public bool? IsResidencyRestricted { get; } + /// The properties of available backup storage redundancies. + public IReadOnlyList BackupStorageRedundancies { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedCassandraProvisioningState.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedCassandraProvisioningState.cs new file mode 100644 index 000000000000..9effb9d94329 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedCassandraProvisioningState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The status of the resource at the time the operation was called. + public readonly partial struct ManagedCassandraProvisioningState : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ManagedCassandraProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Creating. + public static ManagedCassandraProvisioningState Creating { get; } = new ManagedCassandraProvisioningState(CreatingValue); + /// Updating. + public static ManagedCassandraProvisioningState Updating { get; } = new ManagedCassandraProvisioningState(UpdatingValue); + /// Deleting. + public static ManagedCassandraProvisioningState Deleting { get; } = new ManagedCassandraProvisioningState(DeletingValue); + /// Succeeded. + public static ManagedCassandraProvisioningState Succeeded { get; } = new ManagedCassandraProvisioningState(SucceededValue); + /// Failed. + public static ManagedCassandraProvisioningState Failed { get; } = new ManagedCassandraProvisioningState(FailedValue); + /// Canceled. + public static ManagedCassandraProvisioningState Canceled { get; } = new ManagedCassandraProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ManagedCassandraProvisioningState left, ManagedCassandraProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ManagedCassandraProvisioningState left, ManagedCassandraProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ManagedCassandraProvisioningState(string value) => new ManagedCassandraProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ManagedCassandraProvisioningState other && Equals(other); + /// + public bool Equals(ManagedCassandraProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedServiceIdentity.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedServiceIdentity.Serialization.cs new file mode 100644 index 000000000000..195a8b4477b1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedServiceIdentity.Serialization.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ManagedServiceIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToSerialString()); + } + if (Optional.IsCollectionDefined(UserAssignedIdentities)) + { + writer.WritePropertyName("userAssignedIdentities"); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element) + { + Optional principalId = default; + Optional tenantId = default; + Optional type = default; + Optional> userAssignedIdentities = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = property.Value.GetString().ToResourceIdentityType(); + continue; + } + if (property.NameEquals("userAssignedIdentities")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties.DeserializeComponents1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties(property0.Value)); + } + userAssignedIdentities = dictionary; + continue; + } + } + return new ManagedServiceIdentity(principalId.Value, tenantId.Value, Optional.ToNullable(type), Optional.ToDictionary(userAssignedIdentities)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedServiceIdentity.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedServiceIdentity.cs new file mode 100644 index 000000000000..bbade7edf710 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ManagedServiceIdentity.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Identity for the resource. + public partial class ManagedServiceIdentity + { + /// Initializes a new instance of ManagedServiceIdentity. + public ManagedServiceIdentity() + { + UserAssignedIdentities = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of ManagedServiceIdentity. + /// The principal id of the system assigned identity. This property will only be provided for a system assigned identity. + /// The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. + /// The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. + /// The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + internal ManagedServiceIdentity(string principalId, string tenantId, ResourceIdentityType? type, IDictionary userAssignedIdentities) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + } + + /// The principal id of the system assigned identity. This property will only be provided for a system assigned identity. + public string PrincipalId { get; } + /// The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. + public string TenantId { get; } + /// The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. + public ResourceIdentityType? Type { get; set; } + /// The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public IDictionary UserAssignedIdentities { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.Serialization.cs index 73b5c0b0e80a..100e73529a08 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static MongoDBCollectionCreateUpdateParameters DeserializeMongoDBCollec Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; MongoDBCollectionResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static MongoDBCollectionCreateUpdateParameters DeserializeMongoDBCollec tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static MongoDBCollectionCreateUpdateParameters DeserializeMongoDBCollec } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static MongoDBCollectionCreateUpdateParameters DeserializeMongoDBCollec continue; } } - return new MongoDBCollectionCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new MongoDBCollectionCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.cs index a90e34e12680..b7b8e15c032a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class MongoDBCollectionCreateUpdateParameters : ARMResourceProper { /// Initializes a new instance of MongoDBCollectionCreateUpdateParameters. /// The standard JSON format of a MongoDB collection. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public MongoDBCollectionCreateUpdateParameters(MongoDBCollectionResource resource, CreateUpdateOptions options) + /// is null. + public MongoDBCollectionCreateUpdateParameters(MongoDBCollectionResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of MongoDBCollectionCreateUpdateParameters. @@ -38,9 +32,10 @@ public MongoDBCollectionCreateUpdateParameters(MongoDBCollectionResource resourc /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a MongoDB collection. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal MongoDBCollectionCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, MongoDBCollectionResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal MongoDBCollectionCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, MongoDBCollectionResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.Serialization.cs index 1fa772f22930..abdcdfeabc9e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.Serialization.cs @@ -50,7 +50,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static MongoDBCollectionGetPropertiesResource DeserializeMongoDBCollectionGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; Optional> shardKey = default; @@ -70,7 +70,7 @@ internal static MongoDBCollectionGetPropertiesResource DeserializeMongoDBCollect property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -124,7 +124,7 @@ internal static MongoDBCollectionGetPropertiesResource DeserializeMongoDBCollect continue; } } - return new MongoDBCollectionGetPropertiesResource(id, Optional.ToDictionary(shardKey), Optional.ToList(indexes), Optional.ToNullable(analyticalStorageTtl), Rid.Value, Ts.Value, Etag.Value); + return new MongoDBCollectionGetPropertiesResource(id, Optional.ToDictionary(shardKey), Optional.ToList(indexes), Optional.ToNullable(analyticalStorageTtl), Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.cs index 2a9a7929bbc2..177064799a7e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetPropertiesResource.cs @@ -32,7 +32,7 @@ public MongoDBCollectionGetPropertiesResource(string id) : base(id) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal MongoDBCollectionGetPropertiesResource(string id, IDictionary shardKey, IList indexes, int? analyticalStorageTtl, string rid, object ts, string etag) : base(id, shardKey, indexes, analyticalStorageTtl) + internal MongoDBCollectionGetPropertiesResource(string id, IDictionary shardKey, IList indexes, int? analyticalStorageTtl, string rid, float? ts, string etag) : base(id, shardKey, indexes, analyticalStorageTtl) { Rid = rid; Ts = ts; @@ -42,7 +42,7 @@ internal MongoDBCollectionGetPropertiesResource(string id, IDictionary A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.Serialization.cs index 6981ed562cc1..eac1a45c5590 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static MongoDBCollectionGetResults DeserializeMongoDBCollectionGetResul Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static MongoDBCollectionGetResults DeserializeMongoDBCollectionGetResul tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static MongoDBCollectionGetResults DeserializeMongoDBCollectionGetResul continue; } } - return new MongoDBCollectionGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new MongoDBCollectionGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.cs index fab6bf19c1f4..1ab0e033c13e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionGetResults.cs @@ -23,9 +23,10 @@ public MongoDBCollectionGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal MongoDBCollectionGetResults(string id, string name, string type, string location, IDictionary tags, MongoDBCollectionGetPropertiesResource resource, MongoDBCollectionGetPropertiesOptions options) : base(id, name, type, location, tags) + internal MongoDBCollectionGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, MongoDBCollectionGetPropertiesResource resource, MongoDBCollectionGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.Serialization.cs index 7f37bab0dda2..a68b56bab223 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static MongoDBDatabaseCreateUpdateParameters DeserializeMongoDBDatabase Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; MongoDBDatabaseResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static MongoDBDatabaseCreateUpdateParameters DeserializeMongoDBDatabase tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static MongoDBDatabaseCreateUpdateParameters DeserializeMongoDBDatabase } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static MongoDBDatabaseCreateUpdateParameters DeserializeMongoDBDatabase continue; } } - return new MongoDBDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new MongoDBDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.cs index 6a5b9699331a..2c90fdf62745 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class MongoDBDatabaseCreateUpdateParameters : ARMResourceProperti { /// Initializes a new instance of MongoDBDatabaseCreateUpdateParameters. /// The standard JSON format of a MongoDB database. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public MongoDBDatabaseCreateUpdateParameters(MongoDBDatabaseResource resource, CreateUpdateOptions options) + /// is null. + public MongoDBDatabaseCreateUpdateParameters(MongoDBDatabaseResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of MongoDBDatabaseCreateUpdateParameters. @@ -38,9 +32,10 @@ public MongoDBDatabaseCreateUpdateParameters(MongoDBDatabaseResource resource, C /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a MongoDB database. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal MongoDBDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, MongoDBDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal MongoDBDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, MongoDBDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.Serialization.cs index 1041482fc78e..7a704ad6b265 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.Serialization.cs @@ -23,7 +23,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static MongoDBDatabaseGetPropertiesResource DeserializeMongoDBDatabaseGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; foreach (var property in element.EnumerateObject()) @@ -40,7 +40,7 @@ internal static MongoDBDatabaseGetPropertiesResource DeserializeMongoDBDatabaseG property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -54,7 +54,7 @@ internal static MongoDBDatabaseGetPropertiesResource DeserializeMongoDBDatabaseG continue; } } - return new MongoDBDatabaseGetPropertiesResource(id, Rid.Value, Ts.Value, Etag.Value); + return new MongoDBDatabaseGetPropertiesResource(id, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.cs index 7d5cd689ca2d..c1463e305847 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetPropertiesResource.cs @@ -29,7 +29,7 @@ public MongoDBDatabaseGetPropertiesResource(string id) : base(id) /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. /// is null. - internal MongoDBDatabaseGetPropertiesResource(string id, string rid, object ts, string etag) : base(id) + internal MongoDBDatabaseGetPropertiesResource(string id, string rid, float? ts, string etag) : base(id) { if (id == null) { @@ -44,7 +44,7 @@ internal MongoDBDatabaseGetPropertiesResource(string id, string rid, object ts, /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.Serialization.cs index d19d1b1ccb1a..91e299da2991 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static MongoDBDatabaseGetResults DeserializeMongoDBDatabaseGetResults(J Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static MongoDBDatabaseGetResults DeserializeMongoDBDatabaseGetResults(J tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static MongoDBDatabaseGetResults DeserializeMongoDBDatabaseGetResults(J continue; } } - return new MongoDBDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new MongoDBDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.cs index 7a22aa0cef62..f90331121b01 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseGetResults.cs @@ -23,9 +23,10 @@ public MongoDBDatabaseGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal MongoDBDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, MongoDBDatabaseGetPropertiesResource resource, MongoDBDatabaseGetPropertiesOptions options) : base(id, name, type, location, tags) + internal MongoDBDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, MongoDBDatabaseGetPropertiesResource resource, MongoDBDatabaseGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NetworkAclBypass.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NetworkAclBypass.Serialization.cs new file mode 100644 index 000000000000..a450e6005948 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NetworkAclBypass.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal static partial class NetworkAclBypassExtensions + { + public static string ToSerialString(this NetworkAclBypass value) => value switch + { + NetworkAclBypass.None => "None", + NetworkAclBypass.AzureServices => "AzureServices", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown NetworkAclBypass value.") + }; + + public static NetworkAclBypass ToNetworkAclBypass(this string value) + { + if (string.Equals(value, "None", StringComparison.InvariantCultureIgnoreCase)) return NetworkAclBypass.None; + if (string.Equals(value, "AzureServices", StringComparison.InvariantCultureIgnoreCase)) return NetworkAclBypass.AzureServices; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown NetworkAclBypass value."); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NetworkAclBypass.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NetworkAclBypass.cs new file mode 100644 index 000000000000..d337f5ecfb5e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NetworkAclBypass.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates what services are allowed to bypass firewall checks. + public enum NetworkAclBypass + { + /// None. + None, + /// AzureServices. + AzureServices + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeState.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeState.cs new file mode 100644 index 000000000000..95bcba1b5a4a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The state of the node in relation to the cluster. + public readonly partial struct NodeState : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public NodeState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NormalValue = "Normal"; + private const string LeavingValue = "Leaving"; + private const string JoiningValue = "Joining"; + private const string MovingValue = "Moving"; + private const string StoppedValue = "Stopped"; + + /// Normal. + public static NodeState Normal { get; } = new NodeState(NormalValue); + /// Leaving. + public static NodeState Leaving { get; } = new NodeState(LeavingValue); + /// Joining. + public static NodeState Joining { get; } = new NodeState(JoiningValue); + /// Moving. + public static NodeState Moving { get; } = new NodeState(MovingValue); + /// Stopped. + public static NodeState Stopped { get; } = new NodeState(StoppedValue); + /// Determines if two values are the same. + public static bool operator ==(NodeState left, NodeState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NodeState left, NodeState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NodeState(string value) => new NodeState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NodeState other && Equals(other); + /// + public bool Equals(NodeState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeStatus.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeStatus.cs new file mode 100644 index 000000000000..42e4ee1bbd3d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates whether the node is functioning or not. + public readonly partial struct NodeStatus : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public NodeStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UpValue = "Up"; + private const string DownValue = "Down"; + + /// Up. + public static NodeStatus Up { get; } = new NodeStatus(UpValue); + /// Down. + public static NodeStatus Down { get; } = new NodeStatus(DownValue); + /// Determines if two values are the same. + public static bool operator ==(NodeStatus left, NodeStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NodeStatus left, NodeStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NodeStatus(string value) => new NodeStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NodeStatus other && Equals(other); + /// + public bool Equals(NodeStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationType.cs new file mode 100644 index 000000000000..3104fdaf2007 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/OperationType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Enum to indicate the operation type of the event. + public readonly partial struct OperationType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public OperationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreateValue = "Create"; + private const string ReplaceValue = "Replace"; + private const string DeleteValue = "Delete"; + private const string SystemOperationValue = "SystemOperation"; + + /// Create. + public static OperationType Create { get; } = new OperationType(CreateValue); + /// Replace. + public static OperationType Replace { get; } = new OperationType(ReplaceValue); + /// Delete. + public static OperationType Delete { get; } = new OperationType(DeleteValue); + /// SystemOperation. + public static OperationType SystemOperation { get; } = new OperationType(SystemOperationValue); + /// Determines if two values are the same. + public static bool operator ==(OperationType left, OperationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationType left, OperationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OperationType(string value) => new OperationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationType other && Equals(other); + /// + public bool Equals(OperationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionKind.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionKind.cs index 7b7f428085d0..9b3fcb4f7f24 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionKind.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionKind.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CosmosDB.Models { - /// Indicates the kind of algorithm used for partitioning. + /// Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create. public readonly partial struct PartitionKind : IEquatable { private readonly string _value; @@ -24,11 +24,14 @@ public PartitionKind(string value) private const string HashValue = "Hash"; private const string RangeValue = "Range"; + private const string MultiHashValue = "MultiHash"; /// Hash. public static PartitionKind Hash { get; } = new PartitionKind(HashValue); /// Range. public static PartitionKind Range { get; } = new PartitionKind(RangeValue); + /// MultiHash. + public static PartitionKind MultiHash { get; } = new PartitionKind(MultiHashValue); /// Determines if two values are the same. public static bool operator ==(PartitionKind left, PartitionKind right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.Serialization.cs new file mode 100644 index 000000000000..257fa9086a80 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PeriodicModeBackupPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PeriodicModeProperties)) + { + writer.WritePropertyName("periodicModeProperties"); + writer.WriteObjectValue(PeriodicModeProperties); + } + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(MigrationState)) + { + writer.WritePropertyName("migrationState"); + writer.WriteObjectValue(MigrationState); + } + writer.WriteEndObject(); + } + + internal static PeriodicModeBackupPolicy DeserializePeriodicModeBackupPolicy(JsonElement element) + { + Optional periodicModeProperties = default; + BackupPolicyType type = default; + Optional migrationState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("periodicModeProperties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + periodicModeProperties = PeriodicModeProperties.DeserializePeriodicModeProperties(property.Value); + continue; + } + if (property.NameEquals("type")) + { + type = new BackupPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("migrationState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + migrationState = BackupPolicyMigrationState.DeserializeBackupPolicyMigrationState(property.Value); + continue; + } + } + return new PeriodicModeBackupPolicy(type, migrationState.Value, periodicModeProperties.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.cs new file mode 100644 index 000000000000..f2273096ff2d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The object representing periodic mode backup policy. + public partial class PeriodicModeBackupPolicy : BackupPolicy + { + /// Initializes a new instance of PeriodicModeBackupPolicy. + public PeriodicModeBackupPolicy() + { + Type = BackupPolicyType.Periodic; + } + + /// Initializes a new instance of PeriodicModeBackupPolicy. + /// Describes the mode of backups. + /// The object representing the state of the migration between the backup policies. + /// Configuration values for periodic mode backup. + internal PeriodicModeBackupPolicy(BackupPolicyType type, BackupPolicyMigrationState migrationState, PeriodicModeProperties periodicModeProperties) : base(type, migrationState) + { + PeriodicModeProperties = periodicModeProperties; + Type = type; + } + + /// Configuration values for periodic mode backup. + public PeriodicModeProperties PeriodicModeProperties { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.Serialization.cs new file mode 100644 index 000000000000..713b904c3732 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class PeriodicModeProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(BackupIntervalInMinutes)) + { + writer.WritePropertyName("backupIntervalInMinutes"); + writer.WriteNumberValue(BackupIntervalInMinutes.Value); + } + if (Optional.IsDefined(BackupRetentionIntervalInHours)) + { + writer.WritePropertyName("backupRetentionIntervalInHours"); + writer.WriteNumberValue(BackupRetentionIntervalInHours.Value); + } + if (Optional.IsDefined(BackupStorageRedundancy)) + { + writer.WritePropertyName("backupStorageRedundancy"); + writer.WriteStringValue(BackupStorageRedundancy.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static PeriodicModeProperties DeserializePeriodicModeProperties(JsonElement element) + { + Optional backupIntervalInMinutes = default; + Optional backupRetentionIntervalInHours = default; + Optional backupStorageRedundancy = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("backupIntervalInMinutes")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + backupIntervalInMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("backupRetentionIntervalInHours")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + backupRetentionIntervalInHours = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("backupStorageRedundancy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + backupStorageRedundancy = new BackupStorageRedundancy(property.Value.GetString()); + continue; + } + } + return new PeriodicModeProperties(Optional.ToNullable(backupIntervalInMinutes), Optional.ToNullable(backupRetentionIntervalInHours), Optional.ToNullable(backupStorageRedundancy)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.cs new file mode 100644 index 000000000000..a66c1b99604a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Configuration values for periodic mode backup. + public partial class PeriodicModeProperties + { + /// Initializes a new instance of PeriodicModeProperties. + public PeriodicModeProperties() + { + } + + /// Initializes a new instance of PeriodicModeProperties. + /// An integer representing the interval in minutes between two backups. + /// An integer representing the time (in hours) that each backup is retained. + /// Enum to indicate type of backup residency. + internal PeriodicModeProperties(int? backupIntervalInMinutes, int? backupRetentionIntervalInHours, BackupStorageRedundancy? backupStorageRedundancy) + { + BackupIntervalInMinutes = backupIntervalInMinutes; + BackupRetentionIntervalInHours = backupRetentionIntervalInHours; + BackupStorageRedundancy = backupStorageRedundancy; + } + + /// An integer representing the interval in minutes between two backups. + public int? BackupIntervalInMinutes { get; set; } + /// An integer representing the time (in hours) that each backup is retained. + public int? BackupRetentionIntervalInHours { get; set; } + /// Enum to indicate type of backup residency. + public BackupStorageRedundancy? BackupStorageRedundancy { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Permission.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Permission.Serialization.cs new file mode 100644 index 000000000000..17ed38d0673f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Permission.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class Permission : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(DataActions)) + { + writer.WritePropertyName("dataActions"); + writer.WriteStartArray(); + foreach (var item in DataActions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NotDataActions)) + { + writer.WritePropertyName("notDataActions"); + writer.WriteStartArray(); + foreach (var item in NotDataActions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static Permission DeserializePermission(JsonElement element) + { + Optional> dataActions = default; + Optional> notDataActions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dataActions")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dataActions = array; + continue; + } + if (property.NameEquals("notDataActions")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + notDataActions = array; + continue; + } + } + return new Permission(Optional.ToList(dataActions), Optional.ToList(notDataActions)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Permission.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Permission.cs new file mode 100644 index 000000000000..7d0240ea65c5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Permission.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The set of data plane operations permitted through this Role Definition. + public partial class Permission + { + /// Initializes a new instance of Permission. + public Permission() + { + DataActions = new ChangeTrackingList(); + NotDataActions = new ChangeTrackingList(); + } + + /// Initializes a new instance of Permission. + /// An array of data actions that are allowed. + /// An array of data actions that are denied. + internal Permission(IList dataActions, IList notDataActions) + { + DataActions = dataActions; + NotDataActions = notDataActions; + } + + /// An array of data actions that are allowed. + public IList DataActions { get; } + /// An array of data actions that are denied. + public IList NotDataActions { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.Serialization.cs index 5e81e767f56d..23f38b983d36 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.Serialization.cs @@ -27,6 +27,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("privateLinkServiceConnectionState"); writer.WriteObjectValue(PrivateLinkServiceConnectionState); } + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"); + writer.WriteStringValue(GroupId); + } + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"); + writer.WriteStringValue(ProvisioningState); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -38,6 +48,8 @@ internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(J Optional type = default; Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; + Optional groupId = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -84,11 +96,21 @@ internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(J privateLinkServiceConnectionState = PrivateLinkServiceConnectionStateProperty.DeserializePrivateLinkServiceConnectionStateProperty(property0.Value); continue; } + if (property0.NameEquals("groupId")) + { + groupId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState")) + { + provisioningState = property0.Value.GetString(); + continue; + } } continue; } } - return new PrivateEndpointConnection(id.Value, name.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value); + return new PrivateEndpointConnection(id.Value, name.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, groupId.Value, provisioningState.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.cs index 72f157fcec64..8182fb40ead9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnection.cs @@ -16,20 +16,28 @@ public PrivateEndpointConnection() } /// Initializes a new instance of PrivateEndpointConnection. - /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. /// The name of the resource. - /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". /// Private endpoint which the connection belongs to. /// Connection State of the Private Endpoint Connection. - internal PrivateEndpointConnection(string id, string name, string type, PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) : base(id, name, type) + /// Group id of the private endpoint. + /// Provisioning state of the private endpoint. + internal PrivateEndpointConnection(string id, string name, string type, PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState, string groupId, string provisioningState) : base(id, name, type) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + GroupId = groupId; + ProvisioningState = provisioningState; } /// Private endpoint which the connection belongs to. public PrivateEndpointProperty PrivateEndpoint { get; set; } /// Connection State of the Private Endpoint Connection. public PrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } + /// Group id of the private endpoint. + public string GroupId { get; set; } + /// Provisioning state of the private endpoint. + public string ProvisioningState { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.Serialization.cs deleted file mode 100644 index 698b916a8dc3..000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.Serialization.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.CosmosDB.Models -{ - public partial class PrivateEndpointConnectionAutoGenerated : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(PrivateEndpoint)) - { - writer.WritePropertyName("privateEndpoint"); - writer.WriteObjectValue(PrivateEndpoint); - } - if (Optional.IsDefined(PrivateLinkServiceConnectionState)) - { - writer.WritePropertyName("privateLinkServiceConnectionState"); - writer.WriteObjectValue(PrivateLinkServiceConnectionState); - } - if (Optional.IsDefined(GroupId)) - { - writer.WritePropertyName("groupId"); - writer.WriteStringValue(GroupId); - } - if (Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"); - writer.WriteStringValue(ProvisioningState); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static PrivateEndpointConnectionAutoGenerated DeserializePrivateEndpointConnectionAutoGenerated(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional privateEndpoint = default; - Optional privateLinkServiceConnectionState = default; - Optional groupId = default; - Optional provisioningState = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("privateEndpoint")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - privateEndpoint = PrivateEndpointProperty.DeserializePrivateEndpointProperty(property0.Value); - continue; - } - if (property0.NameEquals("privateLinkServiceConnectionState")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - privateLinkServiceConnectionState = PrivateLinkServiceConnectionStatePropertyAutoGenerated.DeserializePrivateLinkServiceConnectionStatePropertyAutoGenerated(property0.Value); - continue; - } - if (property0.NameEquals("groupId")) - { - groupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState")) - { - provisioningState = property0.Value.GetString(); - continue; - } - } - continue; - } - } - return new PrivateEndpointConnectionAutoGenerated(id.Value, name.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, groupId.Value, provisioningState.Value); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.cs deleted file mode 100644 index 3e3ab75c7b72..000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionAutoGenerated.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.CosmosDB.Models -{ - /// A private endpoint connection. - public partial class PrivateEndpointConnectionAutoGenerated : ProxyResource - { - /// Initializes a new instance of PrivateEndpointConnectionAutoGenerated. - public PrivateEndpointConnectionAutoGenerated() - { - } - - /// Initializes a new instance of PrivateEndpointConnectionAutoGenerated. - /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - /// The name of the resource. - /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - /// Private endpoint which the connection belongs to. - /// Connection State of the Private Endpoint Connection. - /// Group id of the private endpoint. - /// Provisioning state of the private endpoint. - internal PrivateEndpointConnectionAutoGenerated(string id, string name, string type, PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStatePropertyAutoGenerated privateLinkServiceConnectionState, string groupId, string provisioningState) : base(id, name, type) - { - PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - GroupId = groupId; - ProvisioningState = provisioningState; - } - - /// Private endpoint which the connection belongs to. - public PrivateEndpointProperty PrivateEndpoint { get; set; } - /// Connection State of the Private Endpoint Connection. - public PrivateLinkServiceConnectionStatePropertyAutoGenerated PrivateLinkServiceConnectionState { get; set; } - /// Group id of the private endpoint. - public string GroupId { get; set; } - /// Provisioning state of the private endpoint. - public string ProvisioningState { get; set; } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.Serialization.cs index a939292bb87b..60c7816c4a66 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.Serialization.cs @@ -15,7 +15,7 @@ internal partial class PrivateEndpointConnectionListResult { internal static PrivateEndpointConnectionListResult DeserializePrivateEndpointConnectionListResult(JsonElement element) { - Optional> value = default; + Optional> value = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) @@ -25,10 +25,10 @@ internal static PrivateEndpointConnectionListResult DeserializePrivateEndpointCo property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(item)); + array.Add(PrivateEndpointConnection.DeserializePrivateEndpointConnection(item)); } value = array; continue; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.cs index 00915d328ad2..b1d039233b02 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointConnectionListResult.cs @@ -16,17 +16,17 @@ internal partial class PrivateEndpointConnectionListResult /// Initializes a new instance of PrivateEndpointConnectionListResult. internal PrivateEndpointConnectionListResult() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of PrivateEndpointConnectionListResult. /// Array of private endpoint connections. - internal PrivateEndpointConnectionListResult(IReadOnlyList value) + internal PrivateEndpointConnectionListResult(IReadOnlyList value) { Value = value; } /// Array of private endpoint connections. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs index 4ba4d384e5bd..061762d0b5d9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs @@ -20,12 +20,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("status"); writer.WriteStringValue(Status); } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } writer.WriteEndObject(); } internal static PrivateLinkServiceConnectionStateProperty DeserializePrivateLinkServiceConnectionStateProperty(JsonElement element) { Optional status = default; + Optional description = default; Optional actionsRequired = default; foreach (var property in element.EnumerateObject()) { @@ -34,13 +40,18 @@ internal static PrivateLinkServiceConnectionStateProperty DeserializePrivateLink status = property.Value.GetString(); continue; } + if (property.NameEquals("description")) + { + description = property.Value.GetString(); + continue; + } if (property.NameEquals("actionsRequired")) { actionsRequired = property.Value.GetString(); continue; } } - return new PrivateLinkServiceConnectionStateProperty(status.Value, actionsRequired.Value); + return new PrivateLinkServiceConnectionStateProperty(status.Value, description.Value, actionsRequired.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs index fa6662ae6f3d..b226917029ee 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs @@ -17,15 +17,19 @@ public PrivateLinkServiceConnectionStateProperty() /// Initializes a new instance of PrivateLinkServiceConnectionStateProperty. /// The private link service connection status. + /// The private link service connection description. /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). - internal PrivateLinkServiceConnectionStateProperty(string status, string actionsRequired) + internal PrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired) { Status = status; + Description = description; ActionsRequired = actionsRequired; } /// The private link service connection status. public string Status { get; set; } + /// The private link service connection description. + public string Description { get; set; } /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). public string ActionsRequired { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs deleted file mode 100644 index 72fff8588b4a..000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.CosmosDB.Models -{ - public partial class PrivateLinkServiceConnectionStatePropertyAutoGenerated : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"); - writer.WriteStringValue(Status); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(Description); - } - writer.WriteEndObject(); - } - - internal static PrivateLinkServiceConnectionStatePropertyAutoGenerated DeserializePrivateLinkServiceConnectionStatePropertyAutoGenerated(JsonElement element) - { - Optional status = default; - Optional description = default; - Optional actionsRequired = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("status")) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("description")) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("actionsRequired")) - { - actionsRequired = property.Value.GetString(); - continue; - } - } - return new PrivateLinkServiceConnectionStatePropertyAutoGenerated(status.Value, description.Value, actionsRequired.Value); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs deleted file mode 100644 index bec93e5e28d1..000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.CosmosDB.Models -{ - /// Connection State of the Private Endpoint Connection. - public partial class PrivateLinkServiceConnectionStatePropertyAutoGenerated - { - /// Initializes a new instance of PrivateLinkServiceConnectionStatePropertyAutoGenerated. - public PrivateLinkServiceConnectionStatePropertyAutoGenerated() - { - } - - /// Initializes a new instance of PrivateLinkServiceConnectionStatePropertyAutoGenerated. - /// The private link service connection status. - /// The private link service connection description. - /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). - internal PrivateLinkServiceConnectionStatePropertyAutoGenerated(string status, string description, string actionsRequired) - { - Status = status; - Description = description; - ActionsRequired = actionsRequired; - } - - /// The private link service connection status. - public string Status { get; set; } - /// The private link service connection description. - public string Description { get; set; } - /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). - public string ActionsRequired { get; } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.cs index a26a3e3cde89..72206447f90a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ProxyResource.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.CosmosDB.Models { - /// The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + /// The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. public partial class ProxyResource : Resource { /// Initializes a new instance of ProxyResource. @@ -16,9 +16,9 @@ public ProxyResource() } /// Initializes a new instance of ProxyResource. - /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. /// The name of the resource. - /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". internal ProxyResource(string id, string name, string type) : base(id, name, type) { } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionalServiceResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionalServiceResource.Serialization.cs new file mode 100644 index 000000000000..8d8502167e52 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionalServiceResource.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RegionalServiceResource + { + internal static RegionalServiceResource DeserializeRegionalServiceResource(JsonElement element) + { + Optional name = default; + Optional location = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new ServiceStatus(property.Value.GetString()); + continue; + } + } + return new RegionalServiceResource(name.Value, location.Value, Optional.ToNullable(status)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionalServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionalServiceResource.cs new file mode 100644 index 000000000000..fc560b8e2cd0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionalServiceResource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Resource for a regional service location. + public partial class RegionalServiceResource + { + /// Initializes a new instance of RegionalServiceResource. + internal RegionalServiceResource() + { + } + + /// Initializes a new instance of RegionalServiceResource. + /// The regional service name. + /// The location name. + /// Describes the status of a service. + internal RegionalServiceResource(string name, string location, ServiceStatus? status) + { + Name = name; + Location = location; + Status = status; + } + + /// The regional service name. + public string Name { get; } + /// The location name. + public string Location { get; } + /// Describes the status of a service. + public ServiceStatus? Status { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RepairPostBody.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RepairPostBody.Serialization.cs new file mode 100644 index 000000000000..4c6b838a2032 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RepairPostBody.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RepairPostBody : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("keyspace"); + writer.WriteStringValue(Keyspace); + if (Optional.IsCollectionDefined(Tables)) + { + writer.WritePropertyName("tables"); + writer.WriteStartArray(); + foreach (var item in Tables) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RepairPostBody.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RepairPostBody.cs new file mode 100644 index 000000000000..c5459efede4a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RepairPostBody.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Specification of the keyspaces and tables to run repair on. + public partial class RepairPostBody + { + /// Initializes a new instance of RepairPostBody. + /// The name of the keyspace that repair should be run on. + /// is null. + public RepairPostBody(string keyspace) + { + if (keyspace == null) + { + throw new ArgumentNullException(nameof(keyspace)); + } + + Keyspace = keyspace; + Tables = new ChangeTrackingList(); + } + + /// The name of the keyspace that repair should be run on. + public string Keyspace { get; } + /// List of tables in the keyspace to repair. If omitted, repair all tables in the keyspace. + public IList Tables { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.cs index 51c36262af05..91d32ef93a5c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/Resource.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.CosmosDB.Models { - /// The Resource. + /// Common fields that are returned in the response for all Azure Resource Manager resources. public partial class Resource { /// Initializes a new instance of Resource. @@ -16,9 +16,9 @@ public Resource() } /// Initializes a new instance of Resource. - /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. /// The name of the resource. - /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". internal Resource(string id, string name, string type) { Id = id; @@ -26,11 +26,11 @@ internal Resource(string id, string name, string type) Type = type; } - /// Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. public string Id { get; } /// The name of the resource. public string Name { get; } - /// The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". public string Type { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceIdentityType.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceIdentityType.Serialization.cs new file mode 100644 index 000000000000..86c2eef1f53f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceIdentityType.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal static partial class ResourceIdentityTypeExtensions + { + public static string ToSerialString(this ResourceIdentityType value) => value switch + { + ResourceIdentityType.SystemAssigned => "SystemAssigned", + ResourceIdentityType.UserAssigned => "UserAssigned", + ResourceIdentityType.SystemAssignedUserAssigned => "SystemAssigned,UserAssigned", + ResourceIdentityType.None => "None", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResourceIdentityType value.") + }; + + public static ResourceIdentityType ToResourceIdentityType(this string value) + { + if (string.Equals(value, "SystemAssigned", StringComparison.InvariantCultureIgnoreCase)) return ResourceIdentityType.SystemAssigned; + if (string.Equals(value, "UserAssigned", StringComparison.InvariantCultureIgnoreCase)) return ResourceIdentityType.UserAssigned; + if (string.Equals(value, "SystemAssigned,UserAssigned", StringComparison.InvariantCultureIgnoreCase)) return ResourceIdentityType.SystemAssignedUserAssigned; + if (string.Equals(value, "None", StringComparison.InvariantCultureIgnoreCase)) return ResourceIdentityType.None; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResourceIdentityType value."); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceIdentityType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..682db907c4ba --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. + public enum ResourceIdentityType + { + /// SystemAssigned. + SystemAssigned, + /// UserAssigned. + UserAssigned, + /// SystemAssigned,UserAssigned. + SystemAssignedUserAssigned, + /// None. + None + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountGetResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountGetResult.Serialization.cs new file mode 100644 index 000000000000..4fe94e40283c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountGetResult.Serialization.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableDatabaseAccountGetResult + { + internal static RestorableDatabaseAccountGetResult DeserializeRestorableDatabaseAccountGetResult(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional location = default; + Optional accountName = default; + Optional creationTime = default; + Optional deletionTime = default; + Optional apiType = default; + Optional> restorableLocations = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("accountName")) + { + accountName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("creationTime")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + creationTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("deletionTime")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + deletionTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("apiType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + apiType = new ApiType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("restorableLocations")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RestorableLocationResource.DeserializeRestorableLocationResource(item)); + } + restorableLocations = array; + continue; + } + } + continue; + } + } + return new RestorableDatabaseAccountGetResult(id.Value, name.Value, type.Value, location.Value, accountName.Value, Optional.ToNullable(creationTime), Optional.ToNullable(deletionTime), Optional.ToNullable(apiType), Optional.ToList(restorableLocations)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountGetResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountGetResult.cs new file mode 100644 index 000000000000..fdf3cf566e58 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountGetResult.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A Azure Cosmos DB restorable database account. + public partial class RestorableDatabaseAccountGetResult + { + /// Initializes a new instance of RestorableDatabaseAccountGetResult. + internal RestorableDatabaseAccountGetResult() + { + RestorableLocations = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestorableDatabaseAccountGetResult. + /// The unique resource identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The location of the resource group to which the resource belongs. + /// The name of the global database account. + /// The creation time of the restorable database account (ISO-8601 format). + /// The time at which the restorable database account has been deleted (ISO-8601 format). + /// The API type of the restorable database account. + /// List of regions where the of the database account can be restored from. + internal RestorableDatabaseAccountGetResult(string id, string name, string type, string location, string accountName, DateTimeOffset? creationTime, DateTimeOffset? deletionTime, ApiType? apiType, IReadOnlyList restorableLocations) + { + Id = id; + Name = name; + Type = type; + Location = location; + AccountName = accountName; + CreationTime = creationTime; + DeletionTime = deletionTime; + ApiType = apiType; + RestorableLocations = restorableLocations; + } + + /// The unique resource identifier of the ARM resource. + public string Id { get; } + /// The name of the ARM resource. + public string Name { get; } + /// The type of Azure resource. + public string Type { get; } + /// The location of the resource group to which the resource belongs. + public string Location { get; } + /// The name of the global database account. + public string AccountName { get; } + /// The creation time of the restorable database account (ISO-8601 format). + public DateTimeOffset? CreationTime { get; } + /// The time at which the restorable database account has been deleted (ISO-8601 format). + public DateTimeOffset? DeletionTime { get; } + /// The API type of the restorable database account. + public ApiType? ApiType { get; } + /// List of regions where the of the database account can be restored from. + public IReadOnlyList RestorableLocations { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.Serialization.cs new file mode 100644 index 000000000000..c70bf33ad775 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class RestorableDatabaseAccountsListResult + { + internal static RestorableDatabaseAccountsListResult DeserializeRestorableDatabaseAccountsListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RestorableDatabaseAccountGetResult.DeserializeRestorableDatabaseAccountGetResult(item)); + } + value = array; + continue; + } + } + return new RestorableDatabaseAccountsListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.cs new file mode 100644 index 000000000000..d424c87e61e2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the restorable database accounts and their properties. + internal partial class RestorableDatabaseAccountsListResult + { + /// Initializes a new instance of RestorableDatabaseAccountsListResult. + internal RestorableDatabaseAccountsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestorableDatabaseAccountsListResult. + /// List of restorable database accounts and their properties. + internal RestorableDatabaseAccountsListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of restorable database accounts and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResource.Serialization.cs new file mode 100644 index 000000000000..b8ee6bd45149 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResource.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableLocationResource + { + internal static RestorableLocationResource DeserializeRestorableLocationResource(JsonElement element) + { + Optional locationName = default; + Optional regionalDatabaseAccountInstanceId = default; + Optional creationTime = default; + Optional deletionTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("locationName")) + { + locationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("regionalDatabaseAccountInstanceId")) + { + regionalDatabaseAccountInstanceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("creationTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("deletionTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deletionTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new RestorableLocationResource(locationName.Value, regionalDatabaseAccountInstanceId.Value, Optional.ToNullable(creationTime), Optional.ToNullable(deletionTime)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResource.cs new file mode 100644 index 000000000000..2c8d621ebfd9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResource.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties of the regional restorable account. + public partial class RestorableLocationResource + { + /// Initializes a new instance of RestorableLocationResource. + internal RestorableLocationResource() + { + } + + /// Initializes a new instance of RestorableLocationResource. + /// The location of the regional restorable account. + /// The instance id of the regional restorable account. + /// The creation time of the regional restorable database account (ISO-8601 format). + /// The time at which the regional restorable database account has been deleted (ISO-8601 format). + internal RestorableLocationResource(string locationName, string regionalDatabaseAccountInstanceId, DateTimeOffset? creationTime, DateTimeOffset? deletionTime) + { + LocationName = locationName; + RegionalDatabaseAccountInstanceId = regionalDatabaseAccountInstanceId; + CreationTime = creationTime; + DeletionTime = deletionTime; + } + + /// The location of the regional restorable account. + public string LocationName { get; } + /// The instance id of the regional restorable account. + public string RegionalDatabaseAccountInstanceId { get; } + /// The creation time of the regional restorable database account (ISO-8601 format). + public DateTimeOffset? CreationTime { get; } + /// The time at which the regional restorable database account has been deleted (ISO-8601 format). + public DateTimeOffset? DeletionTime { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionGetResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionGetResult.Serialization.cs new file mode 100644 index 000000000000..b995594185da --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionGetResult.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableMongodbCollectionGetResult + { + internal static RestorableMongodbCollectionGetResult DeserializeRestorableMongodbCollectionGetResult(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + resource = RestorableMongodbCollectionPropertiesResource.DeserializeRestorableMongodbCollectionPropertiesResource(property0.Value); + continue; + } + } + continue; + } + } + return new RestorableMongodbCollectionGetResult(id.Value, name.Value, type.Value, resource.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionGetResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionGetResult.cs new file mode 100644 index 000000000000..76431f616ece --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionGetResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB MongoDB collection event. + public partial class RestorableMongodbCollectionGetResult + { + /// Initializes a new instance of RestorableMongodbCollectionGetResult. + internal RestorableMongodbCollectionGetResult() + { + } + + /// Initializes a new instance of RestorableMongodbCollectionGetResult. + /// The unique resource Identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The resource of an Azure Cosmos DB MongoDB collection event. + internal RestorableMongodbCollectionGetResult(string id, string name, string type, RestorableMongodbCollectionPropertiesResource resource) + { + Id = id; + Name = name; + Type = type; + Resource = resource; + } + + /// The unique resource Identifier of the ARM resource. + public string Id { get; } + /// The name of the ARM resource. + public string Name { get; } + /// The type of Azure resource. + public string Type { get; } + /// The resource of an Azure Cosmos DB MongoDB collection event. + public RestorableMongodbCollectionPropertiesResource Resource { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..6a476db3eda0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionPropertiesResource.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableMongodbCollectionPropertiesResource + { + internal static RestorableMongodbCollectionPropertiesResource DeserializeRestorableMongodbCollectionPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional operationType = default; + Optional eventTimestamp = default; + Optional ownerId = default; + Optional ownerResourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + operationType = new OperationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("eventTimestamp")) + { + eventTimestamp = property.Value.GetString(); + continue; + } + if (property.NameEquals("ownerId")) + { + ownerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ownerResourceId")) + { + ownerResourceId = property.Value.GetString(); + continue; + } + } + return new RestorableMongodbCollectionPropertiesResource(Rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionPropertiesResource.cs new file mode 100644 index 000000000000..e6f520e58764 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionPropertiesResource.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The resource of an Azure Cosmos DB MongoDB collection event. + public partial class RestorableMongodbCollectionPropertiesResource + { + /// Initializes a new instance of RestorableMongodbCollectionPropertiesResource. + internal RestorableMongodbCollectionPropertiesResource() + { + } + + /// Initializes a new instance of RestorableMongodbCollectionPropertiesResource. + /// A system generated property. A unique identifier. + /// The operation type of this collection event. + /// The time when this collection event happened. + /// The name of this MongoDB collection. + /// The resource ID of this MongoDB collection. + internal RestorableMongodbCollectionPropertiesResource(string rid, OperationType? operationType, string eventTimestamp, string ownerId, string ownerResourceId) + { + Rid = rid; + OperationType = operationType; + EventTimestamp = eventTimestamp; + OwnerId = ownerId; + OwnerResourceId = ownerResourceId; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// The operation type of this collection event. + public OperationType? OperationType { get; } + /// The time when this collection event happened. + public string EventTimestamp { get; } + /// The name of this MongoDB collection. + public string OwnerId { get; } + /// The resource ID of this MongoDB collection. + public string OwnerResourceId { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionsListResult.Serialization.cs new file mode 100644 index 000000000000..4e06fc250dfa --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionsListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class RestorableMongodbCollectionsListResult + { + internal static RestorableMongodbCollectionsListResult DeserializeRestorableMongodbCollectionsListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RestorableMongodbCollectionGetResult.DeserializeRestorableMongodbCollectionGetResult(item)); + } + value = array; + continue; + } + } + return new RestorableMongodbCollectionsListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionsListResult.cs new file mode 100644 index 000000000000..4a948dc28e11 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbCollectionsListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the MongoDB collection events and their properties. + internal partial class RestorableMongodbCollectionsListResult + { + /// Initializes a new instance of RestorableMongodbCollectionsListResult. + internal RestorableMongodbCollectionsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestorableMongodbCollectionsListResult. + /// List of MongoDB collection events and their properties. + internal RestorableMongodbCollectionsListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of MongoDB collection events and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabaseGetResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabaseGetResult.Serialization.cs new file mode 100644 index 000000000000..1457caa231ee --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabaseGetResult.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableMongodbDatabaseGetResult + { + internal static RestorableMongodbDatabaseGetResult DeserializeRestorableMongodbDatabaseGetResult(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + resource = RestorableMongodbDatabasePropertiesResource.DeserializeRestorableMongodbDatabasePropertiesResource(property0.Value); + continue; + } + } + continue; + } + } + return new RestorableMongodbDatabaseGetResult(id.Value, name.Value, type.Value, resource.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabaseGetResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabaseGetResult.cs new file mode 100644 index 000000000000..7703d73602fa --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabaseGetResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB MongoDB database event. + public partial class RestorableMongodbDatabaseGetResult + { + /// Initializes a new instance of RestorableMongodbDatabaseGetResult. + internal RestorableMongodbDatabaseGetResult() + { + } + + /// Initializes a new instance of RestorableMongodbDatabaseGetResult. + /// The unique resource Identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The resource of an Azure Cosmos DB MongoDB database event. + internal RestorableMongodbDatabaseGetResult(string id, string name, string type, RestorableMongodbDatabasePropertiesResource resource) + { + Id = id; + Name = name; + Type = type; + Resource = resource; + } + + /// The unique resource Identifier of the ARM resource. + public string Id { get; } + /// The name of the ARM resource. + public string Name { get; } + /// The type of Azure resource. + public string Type { get; } + /// The resource of an Azure Cosmos DB MongoDB database event. + public RestorableMongodbDatabasePropertiesResource Resource { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasePropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasePropertiesResource.Serialization.cs new file mode 100644 index 000000000000..e1a654eda962 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasePropertiesResource.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableMongodbDatabasePropertiesResource + { + internal static RestorableMongodbDatabasePropertiesResource DeserializeRestorableMongodbDatabasePropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional operationType = default; + Optional eventTimestamp = default; + Optional ownerId = default; + Optional ownerResourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + operationType = new OperationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("eventTimestamp")) + { + eventTimestamp = property.Value.GetString(); + continue; + } + if (property.NameEquals("ownerId")) + { + ownerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ownerResourceId")) + { + ownerResourceId = property.Value.GetString(); + continue; + } + } + return new RestorableMongodbDatabasePropertiesResource(Rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasePropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasePropertiesResource.cs new file mode 100644 index 000000000000..52c404c95ca8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasePropertiesResource.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The resource of an Azure Cosmos DB MongoDB database event. + public partial class RestorableMongodbDatabasePropertiesResource + { + /// Initializes a new instance of RestorableMongodbDatabasePropertiesResource. + internal RestorableMongodbDatabasePropertiesResource() + { + } + + /// Initializes a new instance of RestorableMongodbDatabasePropertiesResource. + /// A system generated property. A unique identifier. + /// The operation type of this database event. + /// The time when this database event happened. + /// The name of this MongoDB database. + /// The resource ID of this MongoDB database. + internal RestorableMongodbDatabasePropertiesResource(string rid, OperationType? operationType, string eventTimestamp, string ownerId, string ownerResourceId) + { + Rid = rid; + OperationType = operationType; + EventTimestamp = eventTimestamp; + OwnerId = ownerId; + OwnerResourceId = ownerResourceId; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// The operation type of this database event. + public OperationType? OperationType { get; } + /// The time when this database event happened. + public string EventTimestamp { get; } + /// The name of this MongoDB database. + public string OwnerId { get; } + /// The resource ID of this MongoDB database. + public string OwnerResourceId { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasesListResult.Serialization.cs new file mode 100644 index 000000000000..7caf41f82f31 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasesListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class RestorableMongodbDatabasesListResult + { + internal static RestorableMongodbDatabasesListResult DeserializeRestorableMongodbDatabasesListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RestorableMongodbDatabaseGetResult.DeserializeRestorableMongodbDatabaseGetResult(item)); + } + value = array; + continue; + } + } + return new RestorableMongodbDatabasesListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasesListResult.cs new file mode 100644 index 000000000000..fbf6f2de426e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbDatabasesListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the MongoDB database events and their properties. + internal partial class RestorableMongodbDatabasesListResult + { + /// Initializes a new instance of RestorableMongodbDatabasesListResult. + internal RestorableMongodbDatabasesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestorableMongodbDatabasesListResult. + /// List of MongoDB database events and their properties. + internal RestorableMongodbDatabasesListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of MongoDB database events and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbResourcesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbResourcesListResult.Serialization.cs new file mode 100644 index 000000000000..73f681481c60 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbResourcesListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class RestorableMongodbResourcesListResult + { + internal static RestorableMongodbResourcesListResult DeserializeRestorableMongodbResourcesListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseRestoreResource.DeserializeDatabaseRestoreResource(item)); + } + value = array; + continue; + } + } + return new RestorableMongodbResourcesListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbResourcesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbResourcesListResult.cs new file mode 100644 index 000000000000..487afa8b1c9e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongodbResourcesListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the restorable MongoDB resources. + internal partial class RestorableMongodbResourcesListResult + { + /// Initializes a new instance of RestorableMongodbResourcesListResult. + internal RestorableMongodbResourcesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestorableMongodbResourcesListResult. + /// List of restorable MongoDB resources, including the database and collection names. + internal RestorableMongodbResourcesListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of restorable MongoDB resources, including the database and collection names. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerGetResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerGetResult.Serialization.cs new file mode 100644 index 000000000000..50c1cc080005 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerGetResult.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableSqlContainerGetResult + { + internal static RestorableSqlContainerGetResult DeserializeRestorableSqlContainerGetResult(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + resource = RestorableSqlContainerPropertiesResource.DeserializeRestorableSqlContainerPropertiesResource(property0.Value); + continue; + } + } + continue; + } + } + return new RestorableSqlContainerGetResult(id.Value, name.Value, type.Value, resource.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerGetResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerGetResult.cs new file mode 100644 index 000000000000..1e6ee2066d4e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerGetResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB SQL container event. + public partial class RestorableSqlContainerGetResult + { + /// Initializes a new instance of RestorableSqlContainerGetResult. + internal RestorableSqlContainerGetResult() + { + } + + /// Initializes a new instance of RestorableSqlContainerGetResult. + /// The unique resource Identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The resource of an Azure Cosmos DB SQL container event. + internal RestorableSqlContainerGetResult(string id, string name, string type, RestorableSqlContainerPropertiesResource resource) + { + Id = id; + Name = name; + Type = type; + Resource = resource; + } + + /// The unique resource Identifier of the ARM resource. + public string Id { get; } + /// The name of the ARM resource. + public string Name { get; } + /// The type of Azure resource. + public string Type { get; } + /// The resource of an Azure Cosmos DB SQL container event. + public RestorableSqlContainerPropertiesResource Resource { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResource.Serialization.cs new file mode 100644 index 000000000000..4e79013afbf1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResource.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableSqlContainerPropertiesResource + { + internal static RestorableSqlContainerPropertiesResource DeserializeRestorableSqlContainerPropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional operationType = default; + Optional eventTimestamp = default; + Optional ownerId = default; + Optional ownerResourceId = default; + Optional container = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + operationType = new OperationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("eventTimestamp")) + { + eventTimestamp = property.Value.GetString(); + continue; + } + if (property.NameEquals("ownerId")) + { + ownerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ownerResourceId")) + { + ownerResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("container")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + container = RestorableSqlContainerPropertiesResourceContainer.DeserializeRestorableSqlContainerPropertiesResourceContainer(property.Value); + continue; + } + } + return new RestorableSqlContainerPropertiesResource(Rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, container.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResource.cs new file mode 100644 index 000000000000..4211d93e7f54 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The resource of an Azure Cosmos DB SQL container event. + public partial class RestorableSqlContainerPropertiesResource + { + /// Initializes a new instance of RestorableSqlContainerPropertiesResource. + internal RestorableSqlContainerPropertiesResource() + { + } + + /// Initializes a new instance of RestorableSqlContainerPropertiesResource. + /// A system generated property. A unique identifier. + /// The operation type of this container event. + /// The when this container event happened. + /// The name of this SQL container. + /// The resource ID of this SQL container. + /// Cosmos DB SQL container resource object. + internal RestorableSqlContainerPropertiesResource(string rid, OperationType? operationType, string eventTimestamp, string ownerId, string ownerResourceId, RestorableSqlContainerPropertiesResourceContainer container) + { + Rid = rid; + OperationType = operationType; + EventTimestamp = eventTimestamp; + OwnerId = ownerId; + OwnerResourceId = ownerResourceId; + Container = container; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// The operation type of this container event. + public OperationType? OperationType { get; } + /// The when this container event happened. + public string EventTimestamp { get; } + /// The name of this SQL container. + public string OwnerId { get; } + /// The resource ID of this SQL container. + public string OwnerResourceId { get; } + /// Cosmos DB SQL container resource object. + public RestorableSqlContainerPropertiesResourceContainer Container { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.Serialization.cs new file mode 100644 index 000000000000..de9fc29b08fc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableSqlContainerPropertiesResourceContainer : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + if (Optional.IsDefined(IndexingPolicy)) + { + writer.WritePropertyName("indexingPolicy"); + writer.WriteObjectValue(IndexingPolicy); + } + if (Optional.IsDefined(PartitionKey)) + { + writer.WritePropertyName("partitionKey"); + writer.WriteObjectValue(PartitionKey); + } + if (Optional.IsDefined(DefaultTtl)) + { + writer.WritePropertyName("defaultTtl"); + writer.WriteNumberValue(DefaultTtl.Value); + } + if (Optional.IsDefined(UniqueKeyPolicy)) + { + writer.WritePropertyName("uniqueKeyPolicy"); + writer.WriteObjectValue(UniqueKeyPolicy); + } + if (Optional.IsDefined(ConflictResolutionPolicy)) + { + writer.WritePropertyName("conflictResolutionPolicy"); + writer.WriteObjectValue(ConflictResolutionPolicy); + } + if (Optional.IsDefined(AnalyticalStorageTtl)) + { + writer.WritePropertyName("analyticalStorageTtl"); + writer.WriteNumberValue(AnalyticalStorageTtl.Value); + } + writer.WriteEndObject(); + } + + internal static RestorableSqlContainerPropertiesResourceContainer DeserializeRestorableSqlContainerPropertiesResourceContainer(JsonElement element) + { + Optional Self = default; + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + Optional indexingPolicy = default; + Optional partitionKey = default; + Optional defaultTtl = default; + Optional uniqueKeyPolicy = default; + Optional conflictResolutionPolicy = default; + Optional analyticalStorageTtl = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_self")) + { + Self = property.Value.GetString(); + continue; + } + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Ts = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("indexingPolicy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + indexingPolicy = IndexingPolicy.DeserializeIndexingPolicy(property.Value); + continue; + } + if (property.NameEquals("partitionKey")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + partitionKey = ContainerPartitionKey.DeserializeContainerPartitionKey(property.Value); + continue; + } + if (property.NameEquals("defaultTtl")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + defaultTtl = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("uniqueKeyPolicy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + uniqueKeyPolicy = UniqueKeyPolicy.DeserializeUniqueKeyPolicy(property.Value); + continue; + } + if (property.NameEquals("conflictResolutionPolicy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + conflictResolutionPolicy = ConflictResolutionPolicy.DeserializeConflictResolutionPolicy(property.Value); + continue; + } + if (property.NameEquals("analyticalStorageTtl")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + analyticalStorageTtl = property.Value.GetInt64(); + continue; + } + } + return new RestorableSqlContainerPropertiesResourceContainer(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), Self.Value, Rid.Value, Optional.ToNullable(Ts), Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.cs new file mode 100644 index 000000000000..ed892e0ccd9a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB SQL container resource object. + public partial class RestorableSqlContainerPropertiesResourceContainer : SqlContainerResource + { + /// Initializes a new instance of RestorableSqlContainerPropertiesResourceContainer. + /// Name of the Cosmos DB SQL container. + /// is null. + public RestorableSqlContainerPropertiesResourceContainer(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of RestorableSqlContainerPropertiesResourceContainer. + /// Name of the Cosmos DB SQL container. + /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. + /// The configuration of the partition key to be used for partitioning data into multiple partitions. + /// Default time to live. + /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + /// The conflict resolution policy for the container. + /// Analytical TTL. + /// A system generated property that specifies the addressable path of the container resource. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + internal RestorableSqlContainerPropertiesResourceContainer(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl, string self, string rid, float? ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, analyticalStorageTtl) + { + Self = self; + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property that specifies the addressable path of the container resource. + public string Self { get; } + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public float? Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.Serialization.cs new file mode 100644 index 000000000000..20e1fbf1f694 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class RestorableSqlContainersListResult + { + internal static RestorableSqlContainersListResult DeserializeRestorableSqlContainersListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RestorableSqlContainerGetResult.DeserializeRestorableSqlContainerGetResult(item)); + } + value = array; + continue; + } + } + return new RestorableSqlContainersListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.cs new file mode 100644 index 000000000000..24b25e523fd2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the SQL container events and their properties. + internal partial class RestorableSqlContainersListResult + { + /// Initializes a new instance of RestorableSqlContainersListResult. + internal RestorableSqlContainersListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestorableSqlContainersListResult. + /// List of SQL container events and their properties. + internal RestorableSqlContainersListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of SQL container events and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabaseGetResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabaseGetResult.Serialization.cs new file mode 100644 index 000000000000..036508849d47 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabaseGetResult.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableSqlDatabaseGetResult + { + internal static RestorableSqlDatabaseGetResult DeserializeRestorableSqlDatabaseGetResult(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional resource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + resource = RestorableSqlDatabasePropertiesResource.DeserializeRestorableSqlDatabasePropertiesResource(property0.Value); + continue; + } + } + continue; + } + } + return new RestorableSqlDatabaseGetResult(id.Value, name.Value, type.Value, resource.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabaseGetResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabaseGetResult.cs new file mode 100644 index 000000000000..61ee603d1875 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabaseGetResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB SQL database event. + public partial class RestorableSqlDatabaseGetResult + { + /// Initializes a new instance of RestorableSqlDatabaseGetResult. + internal RestorableSqlDatabaseGetResult() + { + } + + /// Initializes a new instance of RestorableSqlDatabaseGetResult. + /// The unique resource Identifier of the ARM resource. + /// The name of the ARM resource. + /// The type of Azure resource. + /// The resource of an Azure Cosmos DB SQL database event. + internal RestorableSqlDatabaseGetResult(string id, string name, string type, RestorableSqlDatabasePropertiesResource resource) + { + Id = id; + Name = name; + Type = type; + Resource = resource; + } + + /// The unique resource Identifier of the ARM resource. + public string Id { get; } + /// The name of the ARM resource. + public string Name { get; } + /// The type of Azure resource. + public string Type { get; } + /// The resource of an Azure Cosmos DB SQL database event. + public RestorableSqlDatabasePropertiesResource Resource { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResource.Serialization.cs new file mode 100644 index 000000000000..09cee742f5df --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResource.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableSqlDatabasePropertiesResource + { + internal static RestorableSqlDatabasePropertiesResource DeserializeRestorableSqlDatabasePropertiesResource(JsonElement element) + { + Optional Rid = default; + Optional operationType = default; + Optional eventTimestamp = default; + Optional ownerId = default; + Optional ownerResourceId = default; + Optional database = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + operationType = new OperationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("eventTimestamp")) + { + eventTimestamp = property.Value.GetString(); + continue; + } + if (property.NameEquals("ownerId")) + { + ownerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ownerResourceId")) + { + ownerResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("database")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + database = RestorableSqlDatabasePropertiesResourceDatabase.DeserializeRestorableSqlDatabasePropertiesResourceDatabase(property.Value); + continue; + } + } + return new RestorableSqlDatabasePropertiesResource(Rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, database.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResource.cs new file mode 100644 index 000000000000..8b2438de112c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The resource of an Azure Cosmos DB SQL database event. + public partial class RestorableSqlDatabasePropertiesResource + { + /// Initializes a new instance of RestorableSqlDatabasePropertiesResource. + internal RestorableSqlDatabasePropertiesResource() + { + } + + /// Initializes a new instance of RestorableSqlDatabasePropertiesResource. + /// A system generated property. A unique identifier. + /// The operation type of this database event. + /// The time when this database event happened. + /// The name of the SQL database. + /// The resource ID of the SQL database. + /// Cosmos DB SQL database resource object. + internal RestorableSqlDatabasePropertiesResource(string rid, OperationType? operationType, string eventTimestamp, string ownerId, string ownerResourceId, RestorableSqlDatabasePropertiesResourceDatabase database) + { + Rid = rid; + OperationType = operationType; + EventTimestamp = eventTimestamp; + OwnerId = ownerId; + OwnerResourceId = ownerResourceId; + Database = database; + } + + /// A system generated property. A unique identifier. + public string Rid { get; } + /// The operation type of this database event. + public OperationType? OperationType { get; } + /// The time when this database event happened. + public string EventTimestamp { get; } + /// The name of the SQL database. + public string OwnerId { get; } + /// The resource ID of the SQL database. + public string OwnerResourceId { get; } + /// Cosmos DB SQL database resource object. + public RestorableSqlDatabasePropertiesResourceDatabase Database { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.Serialization.cs new file mode 100644 index 000000000000..18d0466b8bde --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestorableSqlDatabasePropertiesResourceDatabase : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + writer.WriteEndObject(); + } + + internal static RestorableSqlDatabasePropertiesResourceDatabase DeserializeRestorableSqlDatabasePropertiesResourceDatabase(JsonElement element) + { + Optional Colls = default; + Optional Users = default; + Optional Self = default; + Optional Rid = default; + Optional Ts = default; + Optional Etag = default; + string id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("_colls")) + { + Colls = property.Value.GetString(); + continue; + } + if (property.NameEquals("_users")) + { + Users = property.Value.GetString(); + continue; + } + if (property.NameEquals("_self")) + { + Self = property.Value.GetString(); + continue; + } + if (property.NameEquals("_rid")) + { + Rid = property.Value.GetString(); + continue; + } + if (property.NameEquals("_ts")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Ts = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("_etag")) + { + Etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new RestorableSqlDatabasePropertiesResourceDatabase(id, Colls.Value, Users.Value, Self.Value, Rid.Value, Optional.ToNullable(Ts), Etag.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.cs new file mode 100644 index 000000000000..b23b981cc858 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Cosmos DB SQL database resource object. + public partial class RestorableSqlDatabasePropertiesResourceDatabase : SqlDatabaseResource + { + /// Initializes a new instance of RestorableSqlDatabasePropertiesResourceDatabase. + /// Name of the Cosmos DB SQL database. + /// is null. + public RestorableSqlDatabasePropertiesResourceDatabase(string id) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + } + + /// Initializes a new instance of RestorableSqlDatabasePropertiesResourceDatabase. + /// Name of the Cosmos DB SQL database. + /// A system generated property that specified the addressable path of the collections resource. + /// A system generated property that specifies the addressable path of the users resource. + /// A system generated property that specifies the addressable path of the database resource. + /// A system generated property. A unique identifier. + /// A system generated property that denotes the last updated timestamp of the resource. + /// A system generated property representing the resource etag required for optimistic concurrency control. + /// is null. + internal RestorableSqlDatabasePropertiesResourceDatabase(string id, string colls, string users, string self, string rid, float? ts, string etag) : base(id) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Colls = colls; + Users = users; + Self = self; + Rid = rid; + Ts = ts; + Etag = etag; + } + + /// A system generated property that specified the addressable path of the collections resource. + public string Colls { get; } + /// A system generated property that specifies the addressable path of the users resource. + public string Users { get; } + /// A system generated property that specifies the addressable path of the database resource. + public string Self { get; } + /// A system generated property. A unique identifier. + public string Rid { get; } + /// A system generated property that denotes the last updated timestamp of the resource. + public float? Ts { get; } + /// A system generated property representing the resource etag required for optimistic concurrency control. + public string Etag { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.Serialization.cs new file mode 100644 index 000000000000..064b8cda8658 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class RestorableSqlDatabasesListResult + { + internal static RestorableSqlDatabasesListResult DeserializeRestorableSqlDatabasesListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RestorableSqlDatabaseGetResult.DeserializeRestorableSqlDatabaseGetResult(item)); + } + value = array; + continue; + } + } + return new RestorableSqlDatabasesListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.cs new file mode 100644 index 000000000000..81d71ab41466 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the SQL database events and their properties. + internal partial class RestorableSqlDatabasesListResult + { + /// Initializes a new instance of RestorableSqlDatabasesListResult. + internal RestorableSqlDatabasesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestorableSqlDatabasesListResult. + /// List of SQL database events and their properties. + internal RestorableSqlDatabasesListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of SQL database events and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.Serialization.cs new file mode 100644 index 000000000000..4f11588d5c26 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class RestorableSqlResourcesListResult + { + internal static RestorableSqlResourcesListResult DeserializeRestorableSqlResourcesListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseRestoreResource.DeserializeDatabaseRestoreResource(item)); + } + value = array; + continue; + } + } + return new RestorableSqlResourcesListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.cs new file mode 100644 index 000000000000..9b4b31374227 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the restorable SQL resources. + internal partial class RestorableSqlResourcesListResult + { + /// Initializes a new instance of RestorableSqlResourcesListResult. + internal RestorableSqlResourcesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestorableSqlResourcesListResult. + /// List of restorable SQL resources, including the database and collection names. + internal RestorableSqlResourcesListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of restorable SQL resources, including the database and collection names. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreMode.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreMode.cs new file mode 100644 index 000000000000..3f4024913513 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreMode.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the mode of the restore. + public readonly partial struct RestoreMode : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public RestoreMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PointInTimeValue = "PointInTime"; + + /// PointInTime. + public static RestoreMode PointInTime { get; } = new RestoreMode(PointInTimeValue); + /// Determines if two values are the same. + public static bool operator ==(RestoreMode left, RestoreMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RestoreMode left, RestoreMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RestoreMode(string value) => new RestoreMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RestoreMode other && Equals(other); + /// + public bool Equals(RestoreMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParameters.Serialization.cs new file mode 100644 index 000000000000..0afd55f1b13a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParameters.Serialization.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class RestoreParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(RestoreMode)) + { + writer.WritePropertyName("restoreMode"); + writer.WriteStringValue(RestoreMode.Value.ToString()); + } + if (Optional.IsDefined(RestoreSource)) + { + writer.WritePropertyName("restoreSource"); + writer.WriteStringValue(RestoreSource); + } + if (Optional.IsDefined(RestoreTimestampInUtc)) + { + writer.WritePropertyName("restoreTimestampInUtc"); + writer.WriteStringValue(RestoreTimestampInUtc.Value, "O"); + } + if (Optional.IsCollectionDefined(DatabasesToRestore)) + { + writer.WritePropertyName("databasesToRestore"); + writer.WriteStartArray(); + foreach (var item in DatabasesToRestore) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static RestoreParameters DeserializeRestoreParameters(JsonElement element) + { + Optional restoreMode = default; + Optional restoreSource = default; + Optional restoreTimestampInUtc = default; + Optional> databasesToRestore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("restoreMode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + restoreMode = new RestoreMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("restoreSource")) + { + restoreSource = property.Value.GetString(); + continue; + } + if (property.NameEquals("restoreTimestampInUtc")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + restoreTimestampInUtc = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("databasesToRestore")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseRestoreResource.DeserializeDatabaseRestoreResource(item)); + } + databasesToRestore = array; + continue; + } + } + return new RestoreParameters(Optional.ToNullable(restoreMode), restoreSource.Value, Optional.ToNullable(restoreTimestampInUtc), Optional.ToList(databasesToRestore)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParameters.cs new file mode 100644 index 000000000000..047f92e0ba18 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParameters.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to indicate the information about the restore. + public partial class RestoreParameters + { + /// Initializes a new instance of RestoreParameters. + public RestoreParameters() + { + DatabasesToRestore = new ChangeTrackingList(); + } + + /// Initializes a new instance of RestoreParameters. + /// Describes the mode of the restore. + /// The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. + /// Time to which the account has to be restored (ISO-8601 format). + /// List of specific databases available for restore. + internal RestoreParameters(RestoreMode? restoreMode, string restoreSource, DateTimeOffset? restoreTimestampInUtc, IList databasesToRestore) + { + RestoreMode = restoreMode; + RestoreSource = restoreSource; + RestoreTimestampInUtc = restoreTimestampInUtc; + DatabasesToRestore = databasesToRestore; + } + + /// Describes the mode of the restore. + public RestoreMode? RestoreMode { get; set; } + /// The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. + public string RestoreSource { get; set; } + /// Time to which the account has to be restored (ISO-8601 format). + public DateTimeOffset? RestoreTimestampInUtc { get; set; } + /// List of specific databases available for restore. + public IList DatabasesToRestore { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RoleDefinitionType.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RoleDefinitionType.Serialization.cs new file mode 100644 index 000000000000..b3f2ce568b07 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RoleDefinitionType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal static partial class RoleDefinitionTypeExtensions + { + public static string ToSerialString(this RoleDefinitionType value) => value switch + { + RoleDefinitionType.BuiltInRole => "BuiltInRole", + RoleDefinitionType.CustomRole => "CustomRole", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RoleDefinitionType value.") + }; + + public static RoleDefinitionType ToRoleDefinitionType(this string value) + { + if (string.Equals(value, "BuiltInRole", StringComparison.InvariantCultureIgnoreCase)) return RoleDefinitionType.BuiltInRole; + if (string.Equals(value, "CustomRole", StringComparison.InvariantCultureIgnoreCase)) return RoleDefinitionType.CustomRole; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RoleDefinitionType value."); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RoleDefinitionType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RoleDefinitionType.cs new file mode 100644 index 000000000000..7295202d186a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RoleDefinitionType.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates whether the Role Definition was built-in or user created. + public enum RoleDefinitionType + { + /// BuiltInRole. + BuiltInRole, + /// CustomRole. + CustomRole + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SeedNode.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SeedNode.Serialization.cs new file mode 100644 index 000000000000..711c7b51c0fa --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SeedNode.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SeedNode : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(IpAddress)) + { + writer.WritePropertyName("ipAddress"); + writer.WriteStringValue(IpAddress); + } + writer.WriteEndObject(); + } + + internal static SeedNode DeserializeSeedNode(JsonElement element) + { + Optional ipAddress = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipAddress")) + { + ipAddress = property.Value.GetString(); + continue; + } + } + return new SeedNode(ipAddress.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SeedNode.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SeedNode.cs new file mode 100644 index 000000000000..bddad6aaedfc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SeedNode.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The SeedNode. + public partial class SeedNode + { + /// Initializes a new instance of SeedNode. + public SeedNode() + { + } + + /// Initializes a new instance of SeedNode. + /// IP address of this seed node. + internal SeedNode(string ipAddress) + { + IpAddress = ipAddress; + } + + /// IP address of this seed node. + public string IpAddress { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServerVersion.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServerVersion.cs index 0b5e9b20f8c7..bf5c3dc6e272 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServerVersion.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServerVersion.cs @@ -24,11 +24,14 @@ public ServerVersion(string value) private const string Three2Value = "3.2"; private const string Three6Value = "3.6"; + private const string Four0Value = "4.0"; /// 3.2. public static ServerVersion Three2 { get; } = new ServerVersion(Three2Value); /// 3.6. public static ServerVersion Three6 { get; } = new ServerVersion(Three6Value); + /// 4.0. + public static ServerVersion Four0 { get; } = new ServerVersion(Four0Value); /// Determines if two values are the same. public static bool operator ==(ServerVersion left, ServerVersion right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResource.Serialization.cs new file mode 100644 index 000000000000..07f98831195e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResource.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ServiceResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static ServiceResource DeserializeServiceResource(JsonElement element) + { + Optional properties = default; + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = ServiceResourceProperties.DeserializeServiceResourceProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new ServiceResource(id.Value, name.Value, type.Value, properties.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResource.cs new file mode 100644 index 000000000000..a14435a0ceb3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties for the database account. + public partial class ServiceResource : ARMProxyResource + { + /// Initializes a new instance of ServiceResource. + public ServiceResource() + { + } + + /// Initializes a new instance of ServiceResource. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + /// Services response resource. + internal ServiceResource(string id, string name, string type, ServiceResourceProperties properties) : base(id, name, type) + { + Properties = properties; + } + + /// Services response resource. + public ServiceResourceProperties Properties { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..928a1d4a7acc --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceCreateUpdateParameters.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ServiceResourceCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(InstanceSize)) + { + writer.WritePropertyName("instanceSize"); + writer.WriteStringValue(InstanceSize.Value.ToString()); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"); + writer.WriteNumberValue(InstanceCount.Value); + } + if (Optional.IsDefined(ServiceType)) + { + writer.WritePropertyName("serviceType"); + writer.WriteStringValue(ServiceType.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceCreateUpdateParameters.cs new file mode 100644 index 000000000000..5302e7ddb39b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceCreateUpdateParameters.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters for Create or Update Request for ServiceResource. + public partial class ServiceResourceCreateUpdateParameters + { + /// Initializes a new instance of ServiceResourceCreateUpdateParameters. + public ServiceResourceCreateUpdateParameters() + { + } + + /// Instance type for the service. + public ServiceSize? InstanceSize { get; set; } + /// Instance count for the service. + public int? InstanceCount { get; set; } + /// ServiceType for the service. + public ServiceType? ServiceType { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceListResult.Serialization.cs new file mode 100644 index 000000000000..fc76f88a21c1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class ServiceResourceListResult + { + internal static ServiceResourceListResult DeserializeServiceResourceListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ServiceResource.DeserializeServiceResource(item)); + } + value = array; + continue; + } + } + return new ServiceResourceListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceListResult.cs new file mode 100644 index 000000000000..cb317fea0a21 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The List operation response, that contains the Service Resource and their properties. + internal partial class ServiceResourceListResult + { + /// Initializes a new instance of ServiceResourceListResult. + internal ServiceResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServiceResourceListResult. + /// List of Service Resource and their properties. + internal ServiceResourceListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Service Resource and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceProperties.Serialization.cs new file mode 100644 index 000000000000..e366c84fb056 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceProperties.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class ServiceResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(InstanceSize)) + { + writer.WritePropertyName("instanceSize"); + writer.WriteStringValue(InstanceSize.Value.ToString()); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"); + writer.WriteNumberValue(InstanceCount.Value); + } + writer.WritePropertyName("serviceType"); + writer.WriteStringValue(ServiceType.ToString()); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + + internal static ServiceResourceProperties DeserializeServiceResourceProperties(JsonElement element) + { + if (element.TryGetProperty("serviceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "DataTransfer": return DataTransferServiceResourceProperties.DeserializeDataTransferServiceResourceProperties(element); + case "GraphAPICompute": return GraphAPIComputeServiceResourceProperties.DeserializeGraphAPIComputeServiceResourceProperties(element); + case "SqlDedicatedGateway": return SqlDedicatedGatewayServiceResourceProperties.DeserializeSqlDedicatedGatewayServiceResourceProperties(element); + } + } + Optional creationTime = default; + Optional instanceSize = default; + Optional instanceCount = default; + ServiceType serviceType = default; + Optional status = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("creationTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("instanceSize")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + instanceSize = new ServiceSize(property.Value.GetString()); + continue; + } + if (property.NameEquals("instanceCount")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + instanceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("serviceType")) + { + serviceType = new ServiceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new ServiceStatus(property.Value.GetString()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); + } + additionalProperties = additionalPropertiesDictionary; + return new ServiceResourceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceProperties.cs new file mode 100644 index 000000000000..7505014036f4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceResourceProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Services response resource. + public partial class ServiceResourceProperties : IDictionary + { + /// Initializes a new instance of ServiceResourceProperties. + public ServiceResourceProperties() + { + AdditionalProperties = new ChangeTrackingDictionary(); + ServiceType = new ServiceType("ServiceResourceProperties"); + } + + /// Initializes a new instance of ServiceResourceProperties. + /// Time of the last state change (ISO-8601 format). + /// Instance type for the service. + /// Instance count for the service. + /// ServiceType for the service. + /// Describes the status of a service. + /// . + internal ServiceResourceProperties(DateTimeOffset? creationTime, ServiceSize? instanceSize, int? instanceCount, ServiceType serviceType, ServiceStatus? status, IDictionary additionalProperties) + { + CreationTime = creationTime; + InstanceSize = instanceSize; + InstanceCount = instanceCount; + ServiceType = serviceType; + Status = status; + AdditionalProperties = additionalProperties; + } + + /// Time of the last state change (ISO-8601 format). + public DateTimeOffset? CreationTime { get; } + /// Instance type for the service. + public ServiceSize? InstanceSize { get; set; } + /// Instance count for the service. + public int? InstanceCount { get; set; } + /// ServiceType for the service. + internal ServiceType ServiceType { get; set; } + /// Describes the status of a service. + public ServiceStatus? Status { get; } + internal IDictionary AdditionalProperties { get; } + /// + public IEnumerator> GetEnumerator() => AdditionalProperties.GetEnumerator(); + /// + IEnumerator IEnumerable.GetEnumerator() => AdditionalProperties.GetEnumerator(); + /// + public bool TryGetValue(string key, out object value) => AdditionalProperties.TryGetValue(key, out value); + /// + public bool ContainsKey(string key) => AdditionalProperties.ContainsKey(key); + /// + public ICollection Keys => AdditionalProperties.Keys; + /// + public ICollection Values => AdditionalProperties.Values; + /// + int ICollection>.Count => AdditionalProperties.Count; + /// + public void Add(string key, object value) => AdditionalProperties.Add(key, value); + /// + public bool Remove(string key) => AdditionalProperties.Remove(key); + /// + bool ICollection>.IsReadOnly => AdditionalProperties.IsReadOnly; + /// + void ICollection>.Add(KeyValuePair value) => AdditionalProperties.Add(value); + /// + bool ICollection>.Remove(KeyValuePair value) => AdditionalProperties.Remove(value); + /// + bool ICollection>.Contains(KeyValuePair value) => AdditionalProperties.Contains(value); + /// + void ICollection>.CopyTo(KeyValuePair[] destination, int offset) => AdditionalProperties.CopyTo(destination, offset); + /// + void ICollection>.Clear() => AdditionalProperties.Clear(); + /// + public object this[string key] + { + get => AdditionalProperties[key]; + set => AdditionalProperties[key] = value; + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceSize.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceSize.cs new file mode 100644 index 000000000000..7e143c98fbf4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceSize.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Instance type for the service. + public readonly partial struct ServiceSize : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServiceSize(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CosmosD4SValue = "Cosmos.D4s"; + private const string CosmosD8SValue = "Cosmos.D8s"; + private const string CosmosD16SValue = "Cosmos.D16s"; + + /// Cosmos.D4s. + public static ServiceSize CosmosD4S { get; } = new ServiceSize(CosmosD4SValue); + /// Cosmos.D8s. + public static ServiceSize CosmosD8S { get; } = new ServiceSize(CosmosD8SValue); + /// Cosmos.D16s. + public static ServiceSize CosmosD16S { get; } = new ServiceSize(CosmosD16SValue); + /// Determines if two values are the same. + public static bool operator ==(ServiceSize left, ServiceSize right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServiceSize left, ServiceSize right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServiceSize(string value) => new ServiceSize(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServiceSize other && Equals(other); + /// + public bool Equals(ServiceSize other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceStatus.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceStatus.cs new file mode 100644 index 000000000000..407ebda9756f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceStatus.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the status of a service. + public readonly partial struct ServiceStatus : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServiceStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string RunningValue = "Running"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string ErrorValue = "Error"; + private const string StoppedValue = "Stopped"; + + /// Creating. + public static ServiceStatus Creating { get; } = new ServiceStatus(CreatingValue); + /// Running. + public static ServiceStatus Running { get; } = new ServiceStatus(RunningValue); + /// Updating. + public static ServiceStatus Updating { get; } = new ServiceStatus(UpdatingValue); + /// Deleting. + public static ServiceStatus Deleting { get; } = new ServiceStatus(DeletingValue); + /// Error. + public static ServiceStatus Error { get; } = new ServiceStatus(ErrorValue); + /// Stopped. + public static ServiceStatus Stopped { get; } = new ServiceStatus(StoppedValue); + /// Determines if two values are the same. + public static bool operator ==(ServiceStatus left, ServiceStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServiceStatus left, ServiceStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServiceStatus(string value) => new ServiceStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServiceStatus other && Equals(other); + /// + public bool Equals(ServiceStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceType.cs new file mode 100644 index 000000000000..f87abbc4e7e8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ServiceType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// ServiceType for the service. + public readonly partial struct ServiceType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServiceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SqlDedicatedGatewayValue = "SqlDedicatedGateway"; + private const string DataTransferValue = "DataTransfer"; + private const string GraphAPIComputeValue = "GraphAPICompute"; + + /// SqlDedicatedGateway. + public static ServiceType SqlDedicatedGateway { get; } = new ServiceType(SqlDedicatedGatewayValue); + /// DataTransfer. + public static ServiceType DataTransfer { get; } = new ServiceType(DataTransferValue); + /// GraphAPICompute. + public static ServiceType GraphAPICompute { get; } = new ServiceType(GraphAPIComputeValue); + /// Determines if two values are the same. + public static bool operator ==(ServiceType left, ServiceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServiceType left, ServiceType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServiceType(string value) => new ServiceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServiceType other && Equals(other); + /// + public bool Equals(ServiceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.Serialization.cs index c3faa8dd1618..7612f1936336 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static SqlContainerCreateUpdateParameters DeserializeSqlContainerCreate Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; SqlContainerResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static SqlContainerCreateUpdateParameters DeserializeSqlContainerCreate tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static SqlContainerCreateUpdateParameters DeserializeSqlContainerCreate } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static SqlContainerCreateUpdateParameters DeserializeSqlContainerCreate continue; } } - return new SqlContainerCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new SqlContainerCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.cs index f9c940b37c21..d9f4a87e1e91 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class SqlContainerCreateUpdateParameters : ARMResourceProperties { /// Initializes a new instance of SqlContainerCreateUpdateParameters. /// The standard JSON format of a container. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public SqlContainerCreateUpdateParameters(SqlContainerResource resource, CreateUpdateOptions options) + /// is null. + public SqlContainerCreateUpdateParameters(SqlContainerResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of SqlContainerCreateUpdateParameters. @@ -38,9 +32,10 @@ public SqlContainerCreateUpdateParameters(SqlContainerResource resource, CreateU /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a container. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal SqlContainerCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlContainerResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal SqlContainerCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlContainerResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.Serialization.cs index 29549e41a44b..f6f546232cee 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.Serialization.cs @@ -53,7 +53,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static SqlContainerGetPropertiesResource DeserializeSqlContainerGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; Optional indexingPolicy = default; @@ -76,7 +76,7 @@ internal static SqlContainerGetPropertiesResource DeserializeSqlContainerGetProp property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -150,7 +150,7 @@ internal static SqlContainerGetPropertiesResource DeserializeSqlContainerGetProp continue; } } - return new SqlContainerGetPropertiesResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), Rid.Value, Ts.Value, Etag.Value); + return new SqlContainerGetPropertiesResource(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.cs index a47d848ef5b5..c3a8b3b2eea9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetPropertiesResource.cs @@ -34,7 +34,7 @@ public SqlContainerGetPropertiesResource(string id) : base(id) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal SqlContainerGetPropertiesResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl, string rid, object ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, analyticalStorageTtl) + internal SqlContainerGetPropertiesResource(string id, IndexingPolicy indexingPolicy, ContainerPartitionKey partitionKey, int? defaultTtl, UniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl, string rid, float? ts, string etag) : base(id, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, analyticalStorageTtl) { Rid = rid; Ts = ts; @@ -44,7 +44,7 @@ internal SqlContainerGetPropertiesResource(string id, IndexingPolicy indexingPol /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.Serialization.cs index 34117b8361d4..fd659da97eba 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static SqlContainerGetResults DeserializeSqlContainerGetResults(JsonEle Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static SqlContainerGetResults DeserializeSqlContainerGetResults(JsonEle tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static SqlContainerGetResults DeserializeSqlContainerGetResults(JsonEle continue; } } - return new SqlContainerGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new SqlContainerGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.cs index f8e540302ca1..f32335771608 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlContainerGetResults.cs @@ -23,9 +23,10 @@ public SqlContainerGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal SqlContainerGetResults(string id, string name, string type, string location, IDictionary tags, SqlContainerGetPropertiesResource resource, SqlContainerGetPropertiesOptions options) : base(id, name, type, location, tags) + internal SqlContainerGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlContainerGetPropertiesResource resource, SqlContainerGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.Serialization.cs index 911cee9aa89e..398b07524996 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static SqlDatabaseCreateUpdateParameters DeserializeSqlDatabaseCreateUp Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; SqlDatabaseResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static SqlDatabaseCreateUpdateParameters DeserializeSqlDatabaseCreateUp tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static SqlDatabaseCreateUpdateParameters DeserializeSqlDatabaseCreateUp } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static SqlDatabaseCreateUpdateParameters DeserializeSqlDatabaseCreateUp continue; } } - return new SqlDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new SqlDatabaseCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.cs index 4e3ab0cf193f..460b74bf1840 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class SqlDatabaseCreateUpdateParameters : ARMResourceProperties { /// Initializes a new instance of SqlDatabaseCreateUpdateParameters. /// The standard JSON format of a SQL database. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public SqlDatabaseCreateUpdateParameters(SqlDatabaseResource resource, CreateUpdateOptions options) + /// is null. + public SqlDatabaseCreateUpdateParameters(SqlDatabaseResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of SqlDatabaseCreateUpdateParameters. @@ -38,9 +32,10 @@ public SqlDatabaseCreateUpdateParameters(SqlDatabaseResource resource, CreateUpd /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a SQL database. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal SqlDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal SqlDatabaseCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlDatabaseResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.Serialization.cs index 41f766bd1b73..af1dd442cc5d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.Serialization.cs @@ -35,7 +35,7 @@ internal static SqlDatabaseGetPropertiesResource DeserializeSqlDatabaseGetProper Optional Colls = default; Optional Users = default; Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; foreach (var property in element.EnumerateObject()) @@ -62,7 +62,7 @@ internal static SqlDatabaseGetPropertiesResource DeserializeSqlDatabaseGetProper property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -76,7 +76,7 @@ internal static SqlDatabaseGetPropertiesResource DeserializeSqlDatabaseGetProper continue; } } - return new SqlDatabaseGetPropertiesResource(id, Colls.Value, Users.Value, Rid.Value, Ts.Value, Etag.Value); + return new SqlDatabaseGetPropertiesResource(id, Colls.Value, Users.Value, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.cs index b3e9b506aa92..5879e3d8d13a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetPropertiesResource.cs @@ -31,7 +31,7 @@ public SqlDatabaseGetPropertiesResource(string id) : base(id) /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. /// is null. - internal SqlDatabaseGetPropertiesResource(string id, string colls, string users, string rid, object ts, string etag) : base(id) + internal SqlDatabaseGetPropertiesResource(string id, string colls, string users, string rid, float? ts, string etag) : base(id) { if (id == null) { @@ -52,7 +52,7 @@ internal SqlDatabaseGetPropertiesResource(string id, string colls, string users, /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.Serialization.cs index 22aa7b3eb359..9a98fab6a293 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static SqlDatabaseGetResults DeserializeSqlDatabaseGetResults(JsonEleme Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static SqlDatabaseGetResults DeserializeSqlDatabaseGetResults(JsonEleme tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static SqlDatabaseGetResults DeserializeSqlDatabaseGetResults(JsonEleme continue; } } - return new SqlDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new SqlDatabaseGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.cs index d8ff9c346f63..7d3a8b1bb47a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDatabaseGetResults.cs @@ -23,9 +23,10 @@ public SqlDatabaseGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal SqlDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, SqlDatabaseGetPropertiesResource resource, SqlDatabaseGetPropertiesOptions options) : base(id, name, type, location, tags) + internal SqlDatabaseGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlDatabaseGetPropertiesResource resource, SqlDatabaseGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalServiceResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalServiceResource.Serialization.cs new file mode 100644 index 000000000000..f572866949e2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalServiceResource.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlDedicatedGatewayRegionalServiceResource + { + internal static SqlDedicatedGatewayRegionalServiceResource DeserializeSqlDedicatedGatewayRegionalServiceResource(JsonElement element) + { + Optional sqlDedicatedGatewayEndpoint = default; + Optional name = default; + Optional location = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sqlDedicatedGatewayEndpoint")) + { + sqlDedicatedGatewayEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new ServiceStatus(property.Value.GetString()); + continue; + } + } + return new SqlDedicatedGatewayRegionalServiceResource(name.Value, location.Value, Optional.ToNullable(status), sqlDedicatedGatewayEndpoint.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalServiceResource.cs new file mode 100644 index 000000000000..98e61fcafe42 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalServiceResource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Resource for a regional service location. + public partial class SqlDedicatedGatewayRegionalServiceResource : RegionalServiceResource + { + /// Initializes a new instance of SqlDedicatedGatewayRegionalServiceResource. + internal SqlDedicatedGatewayRegionalServiceResource() + { + } + + /// Initializes a new instance of SqlDedicatedGatewayRegionalServiceResource. + /// The regional service name. + /// The location name. + /// Describes the status of a service. + /// The regional endpoint for SqlDedicatedGateway. + internal SqlDedicatedGatewayRegionalServiceResource(string name, string location, ServiceStatus? status, string sqlDedicatedGatewayEndpoint) : base(name, location, status) + { + SqlDedicatedGatewayEndpoint = sqlDedicatedGatewayEndpoint; + } + + /// The regional endpoint for SqlDedicatedGateway. + public string SqlDedicatedGatewayEndpoint { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResource.cs new file mode 100644 index 000000000000..28e71cbad9ef --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResource.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Describes the service response property for SqlDedicatedGateway. + internal partial class SqlDedicatedGatewayServiceResource + { + /// Initializes a new instance of SqlDedicatedGatewayServiceResource. + internal SqlDedicatedGatewayServiceResource() + { + } + + /// Properties for SqlDedicatedGatewayServiceResource. + public SqlDedicatedGatewayServiceResourceProperties Properties { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResourceProperties.Serialization.cs new file mode 100644 index 000000000000..415d11a9931f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResourceProperties.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlDedicatedGatewayServiceResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SqlDedicatedGatewayEndpoint)) + { + writer.WritePropertyName("sqlDedicatedGatewayEndpoint"); + writer.WriteStringValue(SqlDedicatedGatewayEndpoint); + } + if (Optional.IsDefined(InstanceSize)) + { + writer.WritePropertyName("instanceSize"); + writer.WriteStringValue(InstanceSize.Value.ToString()); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"); + writer.WriteNumberValue(InstanceCount.Value); + } + writer.WritePropertyName("serviceType"); + writer.WriteStringValue(ServiceType.ToString()); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + + internal static SqlDedicatedGatewayServiceResourceProperties DeserializeSqlDedicatedGatewayServiceResourceProperties(JsonElement element) + { + Optional sqlDedicatedGatewayEndpoint = default; + Optional> locations = default; + Optional creationTime = default; + Optional instanceSize = default; + Optional instanceCount = default; + ServiceType serviceType = default; + Optional status = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sqlDedicatedGatewayEndpoint")) + { + sqlDedicatedGatewayEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("locations")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SqlDedicatedGatewayRegionalServiceResource.DeserializeSqlDedicatedGatewayRegionalServiceResource(item)); + } + locations = array; + continue; + } + if (property.NameEquals("creationTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("instanceSize")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + instanceSize = new ServiceSize(property.Value.GetString()); + continue; + } + if (property.NameEquals("instanceCount")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + instanceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("serviceType")) + { + serviceType = new ServiceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new ServiceStatus(property.Value.GetString()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); + } + additionalProperties = additionalPropertiesDictionary; + return new SqlDedicatedGatewayServiceResourceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties, sqlDedicatedGatewayEndpoint.Value, Optional.ToList(locations)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResourceProperties.cs new file mode 100644 index 000000000000..896a9e90d0a5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceResourceProperties.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Properties for SqlDedicatedGatewayServiceResource. + public partial class SqlDedicatedGatewayServiceResourceProperties : ServiceResourceProperties + { + /// Initializes a new instance of SqlDedicatedGatewayServiceResourceProperties. + public SqlDedicatedGatewayServiceResourceProperties() + { + Locations = new ChangeTrackingList(); + ServiceType = ServiceType.SqlDedicatedGateway; + } + + /// Initializes a new instance of SqlDedicatedGatewayServiceResourceProperties. + /// Time of the last state change (ISO-8601 format). + /// Instance type for the service. + /// Instance count for the service. + /// ServiceType for the service. + /// Describes the status of a service. + /// . + /// SqlDedicatedGateway endpoint for the service. + /// An array that contains all of the locations for the service. + internal SqlDedicatedGatewayServiceResourceProperties(DateTimeOffset? creationTime, ServiceSize? instanceSize, int? instanceCount, ServiceType serviceType, ServiceStatus? status, IDictionary additionalProperties, string sqlDedicatedGatewayEndpoint, IReadOnlyList locations) : base(creationTime, instanceSize, instanceCount, serviceType, status, additionalProperties) + { + SqlDedicatedGatewayEndpoint = sqlDedicatedGatewayEndpoint; + Locations = locations; + ServiceType = serviceType; + } + + /// SqlDedicatedGateway endpoint for the service. + public string SqlDedicatedGatewayEndpoint { get; set; } + /// An array that contains all of the locations for the service. + public IReadOnlyList Locations { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..b7eea67451c5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentCreateUpdateParameters.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlRoleAssignmentCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("roleDefinitionId"); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentCreateUpdateParameters.cs new file mode 100644 index 000000000000..55bd1d7c19c5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentCreateUpdateParameters.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update an Azure Cosmos DB SQL Role Assignment. + public partial class SqlRoleAssignmentCreateUpdateParameters + { + /// Initializes a new instance of SqlRoleAssignmentCreateUpdateParameters. + public SqlRoleAssignmentCreateUpdateParameters() + { + } + + /// The unique identifier for the associated Role Definition. + public string RoleDefinitionId { get; set; } + /// The data plane resource path for which access is being granted through this Role Assignment. + public string Scope { get; set; } + /// The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. + public string PrincipalId { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentGetResults.Serialization.cs new file mode 100644 index 000000000000..f27e5ffc9b57 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentGetResults.Serialization.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlRoleAssignmentGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("roleDefinitionId"); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlRoleAssignmentGetResults DeserializeSqlRoleAssignmentGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional roleDefinitionId = default; + Optional scope = default; + Optional principalId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("roleDefinitionId")) + { + roleDefinitionId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("scope")) + { + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("principalId")) + { + principalId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new SqlRoleAssignmentGetResults(id.Value, name.Value, type.Value, roleDefinitionId.Value, scope.Value, principalId.Value); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentGetResults.cs new file mode 100644 index 000000000000..3c59d980e22e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentGetResults.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB Role Assignment. + public partial class SqlRoleAssignmentGetResults : ARMProxyResource + { + /// Initializes a new instance of SqlRoleAssignmentGetResults. + public SqlRoleAssignmentGetResults() + { + } + + /// Initializes a new instance of SqlRoleAssignmentGetResults. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + /// The unique identifier for the associated Role Definition. + /// The data plane resource path for which access is being granted through this Role Assignment. + /// The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. + internal SqlRoleAssignmentGetResults(string id, string name, string type, string roleDefinitionId, string scope, string principalId) : base(id, name, type) + { + RoleDefinitionId = roleDefinitionId; + Scope = scope; + PrincipalId = principalId; + } + + /// The unique identifier for the associated Role Definition. + public string RoleDefinitionId { get; set; } + /// The data plane resource path for which access is being granted through this Role Assignment. + public string Scope { get; set; } + /// The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. + public string PrincipalId { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentListResult.Serialization.cs new file mode 100644 index 000000000000..e22d99795069 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class SqlRoleAssignmentListResult + { + internal static SqlRoleAssignmentListResult DeserializeSqlRoleAssignmentListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SqlRoleAssignmentGetResults.DeserializeSqlRoleAssignmentGetResults(item)); + } + value = array; + continue; + } + } + return new SqlRoleAssignmentListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentListResult.cs new file mode 100644 index 000000000000..3043f4cd2006 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleAssignmentListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The relevant Role Assignments. + internal partial class SqlRoleAssignmentListResult + { + /// Initializes a new instance of SqlRoleAssignmentListResult. + internal SqlRoleAssignmentListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SqlRoleAssignmentListResult. + /// List of Role Assignments and their properties. + internal SqlRoleAssignmentListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Role Assignments and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionCreateUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..8cab4ae899a0 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionCreateUpdateParameters.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlRoleDefinitionCreateUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(RoleName)) + { + writer.WritePropertyName("roleName"); + writer.WriteStringValue(RoleName); + } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToSerialString()); + } + if (Optional.IsCollectionDefined(AssignableScopes)) + { + writer.WritePropertyName("assignableScopes"); + writer.WriteStartArray(); + foreach (var item in AssignableScopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Permissions)) + { + writer.WritePropertyName("permissions"); + writer.WriteStartArray(); + foreach (var item in Permissions) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionCreateUpdateParameters.cs new file mode 100644 index 000000000000..890abf4d32d1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionCreateUpdateParameters.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Parameters to create and update an Azure Cosmos DB SQL Role Definition. + public partial class SqlRoleDefinitionCreateUpdateParameters + { + /// Initializes a new instance of SqlRoleDefinitionCreateUpdateParameters. + public SqlRoleDefinitionCreateUpdateParameters() + { + AssignableScopes = new ChangeTrackingList(); + Permissions = new ChangeTrackingList(); + } + + /// A user-friendly name for the Role Definition. Must be unique for the database account. + public string RoleName { get; set; } + /// Indicates whether the Role Definition was built-in or user created. + public RoleDefinitionType? Type { get; set; } + /// A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist. + public IList AssignableScopes { get; } + /// The set of operations allowed through this Role Definition. + public IList Permissions { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionGetResults.Serialization.cs new file mode 100644 index 000000000000..af2f68a20c68 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionGetResults.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SqlRoleDefinitionGetResults : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(RoleName)) + { + writer.WritePropertyName("roleName"); + writer.WriteStringValue(RoleName); + } + if (Optional.IsDefined(TypePropertiesType)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(TypePropertiesType.Value.ToSerialString()); + } + if (Optional.IsCollectionDefined(AssignableScopes)) + { + writer.WritePropertyName("assignableScopes"); + writer.WriteStartArray(); + foreach (var item in AssignableScopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Permissions)) + { + writer.WritePropertyName("permissions"); + writer.WriteStartArray(); + foreach (var item in Permissions) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlRoleDefinitionGetResults DeserializeSqlRoleDefinitionGetResults(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional roleName = default; + Optional type0 = default; + Optional> assignableScopes = default; + Optional> permissions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("roleName")) + { + roleName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("type")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + type0 = property0.Value.GetString().ToRoleDefinitionType(); + continue; + } + if (property0.NameEquals("assignableScopes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + assignableScopes = array; + continue; + } + if (property0.NameEquals("permissions")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Permission.DeserializePermission(item)); + } + permissions = array; + continue; + } + } + continue; + } + } + return new SqlRoleDefinitionGetResults(id.Value, name.Value, type.Value, roleName.Value, Optional.ToNullable(type0), Optional.ToList(assignableScopes), Optional.ToList(permissions)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionGetResults.cs new file mode 100644 index 000000000000..4dd798f88312 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionGetResults.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// An Azure Cosmos DB SQL Role Definition. + public partial class SqlRoleDefinitionGetResults : ARMProxyResource + { + /// Initializes a new instance of SqlRoleDefinitionGetResults. + public SqlRoleDefinitionGetResults() + { + AssignableScopes = new ChangeTrackingList(); + Permissions = new ChangeTrackingList(); + } + + /// Initializes a new instance of SqlRoleDefinitionGetResults. + /// The unique resource identifier of the database account. + /// The name of the database account. + /// The type of Azure resource. + /// A user-friendly name for the Role Definition. Must be unique for the database account. + /// Indicates whether the Role Definition was built-in or user created. + /// A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist. + /// The set of operations allowed through this Role Definition. + internal SqlRoleDefinitionGetResults(string id, string name, string type, string roleName, RoleDefinitionType? typePropertiesType, IList assignableScopes, IList permissions) : base(id, name, type) + { + RoleName = roleName; + TypePropertiesType = typePropertiesType; + AssignableScopes = assignableScopes; + Permissions = permissions; + } + + /// A user-friendly name for the Role Definition. Must be unique for the database account. + public string RoleName { get; set; } + /// Indicates whether the Role Definition was built-in or user created. + public RoleDefinitionType? TypePropertiesType { get; set; } + /// A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist. + public IList AssignableScopes { get; } + /// The set of operations allowed through this Role Definition. + public IList Permissions { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionListResult.Serialization.cs new file mode 100644 index 000000000000..efc671f03f94 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionListResult.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + internal partial class SqlRoleDefinitionListResult + { + internal static SqlRoleDefinitionListResult DeserializeSqlRoleDefinitionListResult(JsonElement element) + { + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SqlRoleDefinitionGetResults.DeserializeSqlRoleDefinitionGetResults(item)); + } + value = array; + continue; + } + } + return new SqlRoleDefinitionListResult(Optional.ToList(value)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionListResult.cs new file mode 100644 index 000000000000..b1df4fed1ae8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlRoleDefinitionListResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The relevant Role Definitions. + internal partial class SqlRoleDefinitionListResult + { + /// Initializes a new instance of SqlRoleDefinitionListResult. + internal SqlRoleDefinitionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SqlRoleDefinitionListResult. + /// List of Role Definitions and their properties. + internal SqlRoleDefinitionListResult(IReadOnlyList value) + { + Value = value; + } + + /// List of Role Definitions and their properties. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.Serialization.cs index b21c32d1635e..ef513306860e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static SqlStoredProcedureCreateUpdateParameters DeserializeSqlStoredPro Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; SqlStoredProcedureResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static SqlStoredProcedureCreateUpdateParameters DeserializeSqlStoredPro tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static SqlStoredProcedureCreateUpdateParameters DeserializeSqlStoredPro } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static SqlStoredProcedureCreateUpdateParameters DeserializeSqlStoredPro continue; } } - return new SqlStoredProcedureCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new SqlStoredProcedureCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.cs index 09f606c7e1f6..8af5beac65f3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class SqlStoredProcedureCreateUpdateParameters : ARMResourcePrope { /// Initializes a new instance of SqlStoredProcedureCreateUpdateParameters. /// The standard JSON format of a storedProcedure. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public SqlStoredProcedureCreateUpdateParameters(SqlStoredProcedureResource resource, CreateUpdateOptions options) + /// is null. + public SqlStoredProcedureCreateUpdateParameters(SqlStoredProcedureResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of SqlStoredProcedureCreateUpdateParameters. @@ -38,9 +32,10 @@ public SqlStoredProcedureCreateUpdateParameters(SqlStoredProcedureResource resou /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a storedProcedure. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal SqlStoredProcedureCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlStoredProcedureResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal SqlStoredProcedureCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlStoredProcedureResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.Serialization.cs index dfcd071198ef..1bd07f66ed6a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.Serialization.cs @@ -28,7 +28,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static SqlStoredProcedureGetPropertiesResource DeserializeSqlStoredProcedureGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; Optional body = default; @@ -46,7 +46,7 @@ internal static SqlStoredProcedureGetPropertiesResource DeserializeSqlStoredProc property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -65,7 +65,7 @@ internal static SqlStoredProcedureGetPropertiesResource DeserializeSqlStoredProc continue; } } - return new SqlStoredProcedureGetPropertiesResource(id, body.Value, Rid.Value, Ts.Value, Etag.Value); + return new SqlStoredProcedureGetPropertiesResource(id, body.Value, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.cs index edba2b95b369..40e2250713d9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetPropertiesResource.cs @@ -29,7 +29,7 @@ public SqlStoredProcedureGetPropertiesResource(string id) : base(id) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal SqlStoredProcedureGetPropertiesResource(string id, string body, string rid, object ts, string etag) : base(id, body) + internal SqlStoredProcedureGetPropertiesResource(string id, string body, string rid, float? ts, string etag) : base(id, body) { Rid = rid; Ts = ts; @@ -39,7 +39,7 @@ internal SqlStoredProcedureGetPropertiesResource(string id, string body, string /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.Serialization.cs index c938a3cc22ce..41aee4b81153 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -50,6 +55,7 @@ internal static SqlStoredProcedureGetResults DeserializeSqlStoredProcedureGetRes Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; foreach (var property in element.EnumerateObject()) { @@ -88,6 +94,16 @@ internal static SqlStoredProcedureGetResults DeserializeSqlStoredProcedureGetRes tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -111,7 +127,7 @@ internal static SqlStoredProcedureGetResults DeserializeSqlStoredProcedureGetRes continue; } } - return new SqlStoredProcedureGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value); + return new SqlStoredProcedureGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.cs index 61d1404494b8..17c7492aede3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlStoredProcedureGetResults.cs @@ -23,8 +23,9 @@ public SqlStoredProcedureGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . - internal SqlStoredProcedureGetResults(string id, string name, string type, string location, IDictionary tags, SqlStoredProcedureGetPropertiesResource resource) : base(id, name, type, location, tags) + internal SqlStoredProcedureGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlStoredProcedureGetPropertiesResource resource) : base(id, name, type, location, tags, identity) { Resource = resource; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.Serialization.cs index 3a467ce27f4a..f56bab876539 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static SqlTriggerCreateUpdateParameters DeserializeSqlTriggerCreateUpda Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; SqlTriggerResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static SqlTriggerCreateUpdateParameters DeserializeSqlTriggerCreateUpda tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static SqlTriggerCreateUpdateParameters DeserializeSqlTriggerCreateUpda } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static SqlTriggerCreateUpdateParameters DeserializeSqlTriggerCreateUpda continue; } } - return new SqlTriggerCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new SqlTriggerCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.cs index 42687f4ef18f..a39c046e53aa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class SqlTriggerCreateUpdateParameters : ARMResourceProperties { /// Initializes a new instance of SqlTriggerCreateUpdateParameters. /// The standard JSON format of a trigger. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public SqlTriggerCreateUpdateParameters(SqlTriggerResource resource, CreateUpdateOptions options) + /// is null. + public SqlTriggerCreateUpdateParameters(SqlTriggerResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of SqlTriggerCreateUpdateParameters. @@ -38,9 +32,10 @@ public SqlTriggerCreateUpdateParameters(SqlTriggerResource resource, CreateUpdat /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a trigger. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal SqlTriggerCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlTriggerResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal SqlTriggerCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlTriggerResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.Serialization.cs index 9e3fe3758a5c..b5ce43d0cea1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.Serialization.cs @@ -38,7 +38,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static SqlTriggerGetPropertiesResource DeserializeSqlTriggerGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; Optional body = default; @@ -58,7 +58,7 @@ internal static SqlTriggerGetPropertiesResource DeserializeSqlTriggerGetProperti property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -97,7 +97,7 @@ internal static SqlTriggerGetPropertiesResource DeserializeSqlTriggerGetProperti continue; } } - return new SqlTriggerGetPropertiesResource(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation), Rid.Value, Ts.Value, Etag.Value); + return new SqlTriggerGetPropertiesResource(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation), Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.cs index ee3385b83fa5..b83f21456b42 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetPropertiesResource.cs @@ -31,7 +31,7 @@ public SqlTriggerGetPropertiesResource(string id) : base(id) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal SqlTriggerGetPropertiesResource(string id, string body, TriggerType? triggerType, TriggerOperation? triggerOperation, string rid, object ts, string etag) : base(id, body, triggerType, triggerOperation) + internal SqlTriggerGetPropertiesResource(string id, string body, TriggerType? triggerType, TriggerOperation? triggerOperation, string rid, float? ts, string etag) : base(id, body, triggerType, triggerOperation) { Rid = rid; Ts = ts; @@ -41,7 +41,7 @@ internal SqlTriggerGetPropertiesResource(string id, string body, TriggerType? tr /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.Serialization.cs index 6198a683b194..c2e7d2e01065 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -50,6 +55,7 @@ internal static SqlTriggerGetResults DeserializeSqlTriggerGetResults(JsonElement Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; foreach (var property in element.EnumerateObject()) { @@ -88,6 +94,16 @@ internal static SqlTriggerGetResults DeserializeSqlTriggerGetResults(JsonElement tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -111,7 +127,7 @@ internal static SqlTriggerGetResults DeserializeSqlTriggerGetResults(JsonElement continue; } } - return new SqlTriggerGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value); + return new SqlTriggerGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.cs index cd2d3e688c13..f546aaf187f8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlTriggerGetResults.cs @@ -23,8 +23,9 @@ public SqlTriggerGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . - internal SqlTriggerGetResults(string id, string name, string type, string location, IDictionary tags, SqlTriggerGetPropertiesResource resource) : base(id, name, type, location, tags) + internal SqlTriggerGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlTriggerGetPropertiesResource resource) : base(id, name, type, location, tags, identity) { Resource = resource; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.Serialization.cs index c2beb5b3f720..f07ef2497a69 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static SqlUserDefinedFunctionCreateUpdateParameters DeserializeSqlUserD Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; SqlUserDefinedFunctionResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static SqlUserDefinedFunctionCreateUpdateParameters DeserializeSqlUserD tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static SqlUserDefinedFunctionCreateUpdateParameters DeserializeSqlUserD } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static SqlUserDefinedFunctionCreateUpdateParameters DeserializeSqlUserD continue; } } - return new SqlUserDefinedFunctionCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new SqlUserDefinedFunctionCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.cs index d80a69a5e3f4..cb461d3fc11f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class SqlUserDefinedFunctionCreateUpdateParameters : ARMResourceP { /// Initializes a new instance of SqlUserDefinedFunctionCreateUpdateParameters. /// The standard JSON format of a userDefinedFunction. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public SqlUserDefinedFunctionCreateUpdateParameters(SqlUserDefinedFunctionResource resource, CreateUpdateOptions options) + /// is null. + public SqlUserDefinedFunctionCreateUpdateParameters(SqlUserDefinedFunctionResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of SqlUserDefinedFunctionCreateUpdateParameters. @@ -38,9 +32,10 @@ public SqlUserDefinedFunctionCreateUpdateParameters(SqlUserDefinedFunctionResour /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a userDefinedFunction. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal SqlUserDefinedFunctionCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, SqlUserDefinedFunctionResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal SqlUserDefinedFunctionCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlUserDefinedFunctionResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.Serialization.cs index 680a97905463..de9c81506c99 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.Serialization.cs @@ -28,7 +28,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static SqlUserDefinedFunctionGetPropertiesResource DeserializeSqlUserDefinedFunctionGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; Optional body = default; @@ -46,7 +46,7 @@ internal static SqlUserDefinedFunctionGetPropertiesResource DeserializeSqlUserDe property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -65,7 +65,7 @@ internal static SqlUserDefinedFunctionGetPropertiesResource DeserializeSqlUserDe continue; } } - return new SqlUserDefinedFunctionGetPropertiesResource(id, body.Value, Rid.Value, Ts.Value, Etag.Value); + return new SqlUserDefinedFunctionGetPropertiesResource(id, body.Value, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.cs index 539f936551b6..a3741447e5e9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetPropertiesResource.cs @@ -29,7 +29,7 @@ public SqlUserDefinedFunctionGetPropertiesResource(string id) : base(id) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal SqlUserDefinedFunctionGetPropertiesResource(string id, string body, string rid, object ts, string etag) : base(id, body) + internal SqlUserDefinedFunctionGetPropertiesResource(string id, string body, string rid, float? ts, string etag) : base(id, body) { Rid = rid; Ts = ts; @@ -39,7 +39,7 @@ internal SqlUserDefinedFunctionGetPropertiesResource(string id, string body, str /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.Serialization.cs index 0f866cc0d210..41914518761c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -50,6 +55,7 @@ internal static SqlUserDefinedFunctionGetResults DeserializeSqlUserDefinedFuncti Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; foreach (var property in element.EnumerateObject()) { @@ -88,6 +94,16 @@ internal static SqlUserDefinedFunctionGetResults DeserializeSqlUserDefinedFuncti tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -111,7 +127,7 @@ internal static SqlUserDefinedFunctionGetResults DeserializeSqlUserDefinedFuncti continue; } } - return new SqlUserDefinedFunctionGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value); + return new SqlUserDefinedFunctionGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.cs index d66e3e1ae87e..095959f5ae98 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlUserDefinedFunctionGetResults.cs @@ -23,8 +23,9 @@ public SqlUserDefinedFunctionGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . - internal SqlUserDefinedFunctionGetResults(string id, string name, string type, string location, IDictionary tags, SqlUserDefinedFunctionGetPropertiesResource resource) : base(id, name, type, location, tags) + internal SqlUserDefinedFunctionGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, SqlUserDefinedFunctionGetPropertiesResource resource) : base(id, name, type, location, tags, identity) { Resource = resource; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SystemData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SystemData.Serialization.cs new file mode 100644 index 000000000000..7ae4cc1755b3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SystemData.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class SystemData + { + internal static SystemData DeserializeSystemData(JsonElement element) + { + Optional createdBy = default; + Optional createdByType = default; + Optional createdAt = default; + Optional lastModifiedBy = default; + Optional lastModifiedByType = default; + Optional lastModifiedAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("createdBy")) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdByType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + createdByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdAt")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + createdAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy")) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedByType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastModifiedByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("lastModifiedAt")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastModifiedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new SystemData(createdBy.Value, Optional.ToNullable(createdByType), Optional.ToNullable(createdAt), lastModifiedBy.Value, Optional.ToNullable(lastModifiedByType), Optional.ToNullable(lastModifiedAt)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SystemData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..b5bd30252373 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SystemData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData + { + /// Initializes a new instance of SystemData. + internal SystemData() + { + } + + /// Initializes a new instance of SystemData. + /// The identity that created the resource. + /// The type of identity that created the resource. + /// The timestamp of resource creation (UTC). + /// The identity that last modified the resource. + /// The type of identity that last modified the resource. + /// The timestamp of resource last modification (UTC). + internal SystemData(string createdBy, CreatedByType? createdByType, DateTimeOffset? createdAt, string lastModifiedBy, CreatedByType? lastModifiedByType, DateTimeOffset? lastModifiedAt) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + } + + /// The identity that created the resource. + public string CreatedBy { get; } + /// The type of identity that created the resource. + public CreatedByType? CreatedByType { get; } + /// The timestamp of resource creation (UTC). + public DateTimeOffset? CreatedAt { get; } + /// The identity that last modified the resource. + public string LastModifiedBy { get; } + /// The type of identity that last modified the resource. + public CreatedByType? LastModifiedByType { get; } + /// The timestamp of resource last modification (UTC). + public DateTimeOffset? LastModifiedAt { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.Serialization.cs index 45681ec0cec7..37be25830296 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.Serialization.cs @@ -32,12 +32,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); writer.WriteObjectValue(Resource); - writer.WritePropertyName("options"); - writer.WriteObjectValue(Options); + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"); + writer.WriteObjectValue(Options); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -49,8 +57,9 @@ internal static TableCreateUpdateParameters DeserializeTableCreateUpdateParamete Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; TableResource resource = default; - CreateUpdateOptions options = default; + Optional options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -88,6 +97,16 @@ internal static TableCreateUpdateParameters DeserializeTableCreateUpdateParamete tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -104,6 +123,11 @@ internal static TableCreateUpdateParameters DeserializeTableCreateUpdateParamete } if (property0.NameEquals("options")) { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } options = CreateUpdateOptions.DeserializeCreateUpdateOptions(property0.Value); continue; } @@ -111,7 +135,7 @@ internal static TableCreateUpdateParameters DeserializeTableCreateUpdateParamete continue; } } - return new TableCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource, options); + return new TableCreateUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.cs index 3336a38f9773..ef12d36e5637 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableCreateUpdateParameters.cs @@ -15,21 +15,15 @@ public partial class TableCreateUpdateParameters : ARMResourceProperties { /// Initializes a new instance of TableCreateUpdateParameters. /// The standard JSON format of a Table. - /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - /// or is null. - public TableCreateUpdateParameters(TableResource resource, CreateUpdateOptions options) + /// is null. + public TableCreateUpdateParameters(TableResource resource) { if (resource == null) { throw new ArgumentNullException(nameof(resource)); } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } Resource = resource; - Options = options; } /// Initializes a new instance of TableCreateUpdateParameters. @@ -38,9 +32,10 @@ public TableCreateUpdateParameters(TableResource resource, CreateUpdateOptions o /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a Table. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - internal TableCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, TableResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags) + internal TableCreateUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, TableResource resource, CreateUpdateOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.Serialization.cs index d9a8a921b931..2c414460150e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.Serialization.cs @@ -23,7 +23,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static TableGetPropertiesResource DeserializeTableGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; string id = default; foreach (var property in element.EnumerateObject()) @@ -40,7 +40,7 @@ internal static TableGetPropertiesResource DeserializeTableGetPropertiesResource property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -54,7 +54,7 @@ internal static TableGetPropertiesResource DeserializeTableGetPropertiesResource continue; } } - return new TableGetPropertiesResource(id, Rid.Value, Ts.Value, Etag.Value); + return new TableGetPropertiesResource(id, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.cs index 4c8dd0dbce51..b1c543f63908 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetPropertiesResource.cs @@ -29,7 +29,7 @@ public TableGetPropertiesResource(string id) : base(id) /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. /// is null. - internal TableGetPropertiesResource(string id, string rid, object ts, string etag) : base(id) + internal TableGetPropertiesResource(string id, string rid, float? ts, string etag) : base(id) { if (id == null) { @@ -44,7 +44,7 @@ internal TableGetPropertiesResource(string id, string rid, object ts, string eta /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.Serialization.cs index 0bfcfcb9cc54..8c5ce5847032 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -55,6 +60,7 @@ internal static TableGetResults DeserializeTableGetResults(JsonElement element) Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; Optional options = default; foreach (var property in element.EnumerateObject()) @@ -94,6 +100,16 @@ internal static TableGetResults DeserializeTableGetResults(JsonElement element) tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -127,7 +143,7 @@ internal static TableGetResults DeserializeTableGetResults(JsonElement element) continue; } } - return new TableGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value, options.Value); + return new TableGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value, options.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.cs index 5d594afc9fbe..5b78945f420b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/TableGetResults.cs @@ -23,9 +23,10 @@ public TableGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . /// . - internal TableGetResults(string id, string name, string type, string location, IDictionary tags, TableGetPropertiesResource resource, TableGetPropertiesOptions options) : base(id, name, type, location, tags) + internal TableGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, TableGetPropertiesResource resource, TableGetPropertiesOptions options) : base(id, name, type, location, tags, identity) { Resource = resource; Options = options; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.Serialization.cs index 51e22e0519f3..0783c430febc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.Serialization.cs @@ -31,7 +31,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ThroughputSettingsGetPropertiesResource DeserializeThroughputSettingsGetPropertiesResource(JsonElement element) { Optional Rid = default; - Optional Ts = default; + Optional Ts = default; Optional Etag = default; Optional throughput = default; Optional autoscaleSettings = default; @@ -51,7 +51,7 @@ internal static ThroughputSettingsGetPropertiesResource DeserializeThroughputSet property.ThrowNonNullablePropertyIsNull(); continue; } - Ts = property.Value.GetObject(); + Ts = property.Value.GetSingle(); continue; } if (property.NameEquals("_etag")) @@ -90,7 +90,7 @@ internal static ThroughputSettingsGetPropertiesResource DeserializeThroughputSet continue; } } - return new ThroughputSettingsGetPropertiesResource(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, Rid.Value, Ts.Value, Etag.Value); + return new ThroughputSettingsGetPropertiesResource(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, Rid.Value, Optional.ToNullable(Ts), Etag.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.cs index 74de1bb0f78a..33f99787d28b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetPropertiesResource.cs @@ -23,7 +23,7 @@ public ThroughputSettingsGetPropertiesResource() /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ThroughputSettingsGetPropertiesResource(int? throughput, AutoscaleSettingsResource autoscaleSettings, string minimumThroughput, string offerReplacePending, string rid, object ts, string etag) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending) + internal ThroughputSettingsGetPropertiesResource(int? throughput, AutoscaleSettingsResource autoscaleSettings, string minimumThroughput, string offerReplacePending, string rid, float? ts, string etag) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending) { Rid = rid; Ts = ts; @@ -33,7 +33,7 @@ internal ThroughputSettingsGetPropertiesResource(int? throughput, AutoscaleSetti /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. - public object Ts { get; } + public float? Ts { get; } /// A system generated property representing the resource etag required for optimistic concurrency control. public string Etag { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.Serialization.cs index 13b4a01ab2e9..e5330af112e3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) @@ -50,6 +55,7 @@ internal static ThroughputSettingsGetResults DeserializeThroughputSettingsGetRes Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; Optional resource = default; foreach (var property in element.EnumerateObject()) { @@ -88,6 +94,16 @@ internal static ThroughputSettingsGetResults DeserializeThroughputSettingsGetRes tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -111,7 +127,7 @@ internal static ThroughputSettingsGetResults DeserializeThroughputSettingsGetRes continue; } } - return new ThroughputSettingsGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource.Value); + return new ThroughputSettingsGetResults(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.cs index be7338626463..02cfd885b0a8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsGetResults.cs @@ -23,8 +23,9 @@ public ThroughputSettingsGetResults() /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// . - internal ThroughputSettingsGetResults(string id, string name, string type, string location, IDictionary tags, ThroughputSettingsGetPropertiesResource resource) : base(id, name, type, location, tags) + internal ThroughputSettingsGetResults(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, ThroughputSettingsGetPropertiesResource resource) : base(id, name, type, location, tags, identity) { Resource = resource; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.Serialization.cs index 6e6229e1503c..f9aa989501ac 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.Serialization.cs @@ -32,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("resource"); @@ -47,6 +52,7 @@ internal static ThroughputSettingsUpdateParameters DeserializeThroughputSettings Optional type = default; Optional location = default; Optional> tags = default; + Optional identity = default; ThroughputSettingsResource resource = default; foreach (var property in element.EnumerateObject()) { @@ -85,6 +91,16 @@ internal static ThroughputSettingsUpdateParameters DeserializeThroughputSettings tags = dictionary; continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); + continue; + } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -103,7 +119,7 @@ internal static ThroughputSettingsUpdateParameters DeserializeThroughputSettings continue; } } - return new ThroughputSettingsUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), resource); + return new ThroughputSettingsUpdateParameters(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity.Value, resource); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.cs index af31fcf6f583..00edcffae2d6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateParameters.cs @@ -32,8 +32,9 @@ public ThroughputSettingsUpdateParameters(ThroughputSettingsResource resource) /// The type of Azure resource. /// The location of the resource group to which the resource belongs. /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// Identity for the resource. /// The standard JSON format of a resource throughput. - internal ThroughputSettingsUpdateParameters(string id, string name, string type, string location, IDictionary tags, ThroughputSettingsResource resource) : base(id, name, type, location, tags) + internal ThroughputSettingsUpdateParameters(string id, string name, string type, string location, IDictionary tags, ManagedServiceIdentity identity, ThroughputSettingsResource resource) : base(id, name, type, location, tags, identity) { Resource = resource; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesOperations.cs index d815b774e343..8d818bc66b65 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesOperations.cs @@ -32,9 +32,10 @@ protected MongoDBResourcesOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal MongoDBResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal MongoDBResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new MongoDBResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new MongoDBResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesRestOperations.cs index b9848664aea2..ac1fde63f35b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBResourcesRestOperations.cs @@ -20,6 +20,7 @@ internal partial class MongoDBResourcesRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class MongoDBResourcesRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public MongoDBResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public MongoDBResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListMongoDBDatabasesRequest(string resourceGroupName, uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/mongodbDatabases", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +149,7 @@ internal HttpMessage CreateGetMongoDBDatabaseRequest(string resourceGroupName, s uri.AppendPath(accountName, true); uri.AppendPath("/mongodbDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -237,7 +244,7 @@ internal HttpMessage CreateCreateUpdateMongoDBDatabaseRequest(string resourceGro uri.AppendPath(accountName, true); uri.AppendPath("/mongodbDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -338,7 +345,7 @@ internal HttpMessage CreateDeleteMongoDBDatabaseRequest(string resourceGroupName uri.AppendPath(accountName, true); uri.AppendPath("/mongodbDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -425,7 +432,7 @@ internal HttpMessage CreateGetMongoDBDatabaseThroughputRequest(string resourceGr uri.AppendPath("/mongodbDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -521,7 +528,7 @@ internal HttpMessage CreateUpdateMongoDBDatabaseThroughputRequest(string resourc uri.AppendPath("/mongodbDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -623,7 +630,7 @@ internal HttpMessage CreateMigrateMongoDBDatabaseToAutoscaleRequest(string resou uri.AppendPath("/mongodbDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -711,7 +718,7 @@ internal HttpMessage CreateMigrateMongoDBDatabaseToManualThroughputRequest(strin uri.AppendPath("/mongodbDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -799,7 +806,7 @@ internal HttpMessage CreateListMongoDBCollectionsRequest(string resourceGroupNam uri.AppendPath("/mongodbDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/collections", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -896,7 +903,7 @@ internal HttpMessage CreateGetMongoDBCollectionRequest(string resourceGroupName, uri.AppendPath(databaseName, true); uri.AppendPath("/collections/", false); uri.AppendPath(collectionName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1003,7 +1010,7 @@ internal HttpMessage CreateCreateUpdateMongoDBCollectionRequest(string resourceG uri.AppendPath(databaseName, true); uri.AppendPath("/collections/", false); uri.AppendPath(collectionName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1116,7 +1123,7 @@ internal HttpMessage CreateDeleteMongoDBCollectionRequest(string resourceGroupNa uri.AppendPath(databaseName, true); uri.AppendPath("/collections/", false); uri.AppendPath(collectionName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -1215,7 +1222,7 @@ internal HttpMessage CreateGetMongoDBCollectionThroughputRequest(string resource uri.AppendPath("/collections/", false); uri.AppendPath(collectionName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1323,7 +1330,7 @@ internal HttpMessage CreateUpdateMongoDBCollectionThroughputRequest(string resou uri.AppendPath("/collections/", false); uri.AppendPath(collectionName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1437,7 +1444,7 @@ internal HttpMessage CreateMigrateMongoDBCollectionToAutoscaleRequest(string res uri.AppendPath("/collections/", false); uri.AppendPath(collectionName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1537,7 +1544,7 @@ internal HttpMessage CreateMigrateMongoDBCollectionToManualThroughputRequest(str uri.AppendPath("/collections/", false); uri.AppendPath(collectionName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesOperations.cs index 995fefa2dd2a..338f12aa75a2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesOperations.cs @@ -32,9 +32,10 @@ protected NotebookWorkspacesOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal NotebookWorkspacesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal NotebookWorkspacesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new NotebookWorkspacesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new NotebookWorkspacesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRestOperations.cs index 8b421686d8ae..6375bca6b36f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/NotebookWorkspacesRestOperations.cs @@ -20,6 +20,7 @@ internal partial class NotebookWorkspacesRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class NotebookWorkspacesRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public NotebookWorkspacesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public NotebookWorkspacesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListByDatabaseAccountRequest(string resourceGroupName uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/notebookWorkspaces", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +149,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string accountNa uri.AppendPath(accountName, true); uri.AppendPath("/notebookWorkspaces/", false); uri.AppendPath(notebookWorkspaceName.ToString(), true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -229,7 +236,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(accountName, true); uri.AppendPath("/notebookWorkspaces/", false); uri.AppendPath(notebookWorkspaceName.ToString(), true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -320,7 +327,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accoun uri.AppendPath(accountName, true); uri.AppendPath("/notebookWorkspaces/", false); uri.AppendPath(notebookWorkspaceName.ToString(), true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -400,7 +407,7 @@ internal HttpMessage CreateListConnectionInfoRequest(string resourceGroupName, s uri.AppendPath("/notebookWorkspaces/", false); uri.AppendPath(notebookWorkspaceName.ToString(), true); uri.AppendPath("/listConnectionInfo", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -488,7 +495,7 @@ internal HttpMessage CreateRegenerateAuthTokenRequest(string resourceGroupName, uri.AppendPath("/notebookWorkspaces/", false); uri.AppendPath(notebookWorkspaceName.ToString(), true); uri.AppendPath("/regenerateAuthToken", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -568,7 +575,7 @@ internal HttpMessage CreateStartRequest(string resourceGroupName, string account uri.AppendPath("/notebookWorkspaces/", false); uri.AppendPath(notebookWorkspaceName.ToString(), true); uri.AppendPath("/start", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Operations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Operations.cs index 36ded7560195..41294179af34 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Operations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Operations.cs @@ -31,9 +31,10 @@ protected Operations() /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// server parameter. - internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + /// Api Version. + internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new RestOperations(clientDiagnostics, pipeline, endpoint); + RestClient = new RestOperations(clientDiagnostics, pipeline, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdOperations.cs index 23436f3af6f0..ab86832229a4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdOperations.cs @@ -32,9 +32,10 @@ protected PartitionKeyRangeIdOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal PartitionKeyRangeIdOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal PartitionKeyRangeIdOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new PartitionKeyRangeIdRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new PartitionKeyRangeIdRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionOperations.cs index c7c4acd0aebf..1162dca29fce 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionOperations.cs @@ -32,9 +32,10 @@ protected PartitionKeyRangeIdRegionOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal PartitionKeyRangeIdRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal PartitionKeyRangeIdRegionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new PartitionKeyRangeIdRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new PartitionKeyRangeIdRegionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionRestOperations.cs index ede3184f35d5..a423e5398007 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRegionRestOperations.cs @@ -20,6 +20,7 @@ internal partial class PartitionKeyRangeIdRegionRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class PartitionKeyRangeIdRegionRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public PartitionKeyRangeIdRegionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public PartitionKeyRangeIdRegionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -65,7 +72,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/partitionKeyRangeId/", false); uri.AppendPath(partitionKeyRangeId, true); uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRestOperations.cs index b35fe4631784..b13fb9169757 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PartitionKeyRangeIdRestOperations.cs @@ -20,6 +20,7 @@ internal partial class PartitionKeyRangeIdRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class PartitionKeyRangeIdRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public PartitionKeyRangeIdRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public PartitionKeyRangeIdRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -63,7 +70,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/partitionKeyRangeId/", false); uri.AppendPath(partitionKeyRangeId, true); uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileOperations.cs index 6f908b8eed63..aa2331509bba 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileOperations.cs @@ -32,9 +32,10 @@ protected PercentileOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal PercentileOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal PercentileOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new PercentileRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new PercentileRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileRestOperations.cs index cf8117d599d4..040a2f6cd65c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileRestOperations.cs @@ -20,6 +20,7 @@ internal partial class PercentileRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class PercentileRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public PercentileRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public PercentileRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/percentile/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetOperations.cs index 5d237a2ad6ea..1ca89094e172 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetOperations.cs @@ -32,9 +32,10 @@ protected PercentileSourceTargetOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal PercentileSourceTargetOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal PercentileSourceTargetOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new PercentileSourceTargetRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new PercentileSourceTargetRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetRestOperations.cs index e8a7b7df8bf6..4281e42f046b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileSourceTargetRestOperations.cs @@ -20,6 +20,7 @@ internal partial class PercentileSourceTargetRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class PercentileSourceTargetRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public PercentileSourceTargetRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public PercentileSourceTargetRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -61,7 +68,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/targetRegion/", false); uri.AppendPath(targetRegion, true); uri.AppendPath("/percentile/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetOperations.cs index e4acf0c44ad3..90ac87334474 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetOperations.cs @@ -32,9 +32,10 @@ protected PercentileTargetOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal PercentileTargetOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal PercentileTargetOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new PercentileTargetRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new PercentileTargetRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetRestOperations.cs index a7bb03f236a5..292e477cddb8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PercentileTargetRestOperations.cs @@ -20,6 +20,7 @@ internal partial class PercentileTargetRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class PercentileTargetRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public PercentileTargetRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public PercentileTargetRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -59,7 +66,7 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string a uri.AppendPath("/targetRegion/", false); uri.AppendPath(targetRegion, true); uri.AppendPath("/percentile/metrics", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsCreateOrUpdateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsCreateOrUpdateOperation.cs index 79c2326d8135..b1925d9f78cb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsCreateOrUpdateOperation.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsCreateOrUpdateOperation.cs @@ -17,9 +17,9 @@ namespace Azure.ResourceManager.CosmosDB { /// Approve or reject a private endpoint connection with a given name. - public partial class PrivateEndpointConnectionsCreateOrUpdateOperation : Operation, IOperationSource + public partial class PrivateEndpointConnectionsCreateOrUpdateOperation : Operation, IOperationSource { - private readonly ArmOperationHelpers _operation; + private readonly ArmOperationHelpers _operation; /// Initializes a new instance of PrivateEndpointConnectionsCreateOrUpdateOperation for mocking. protected PrivateEndpointConnectionsCreateOrUpdateOperation() @@ -28,13 +28,13 @@ protected PrivateEndpointConnectionsCreateOrUpdateOperation() internal PrivateEndpointConnectionsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateEndpointConnectionsCreateOrUpdateOperation"); + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateEndpointConnectionsCreateOrUpdateOperation"); } /// public override string Id => _operation.Id; /// - public override PrivateEndpointConnectionAutoGenerated Value => _operation.Value; + public override PrivateEndpointConnection Value => _operation.Value; /// public override bool HasCompleted => _operation.HasCompleted; @@ -52,21 +52,21 @@ internal PrivateEndpointConnectionsCreateOrUpdateOperation(ClientDiagnostics cli public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - PrivateEndpointConnectionAutoGenerated IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + PrivateEndpointConnection IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(document.RootElement); + return PrivateEndpointConnection.DeserializePrivateEndpointConnection(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(document.RootElement); + return PrivateEndpointConnection.DeserializePrivateEndpointConnection(document.RootElement); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsOperations.cs index fb1a4c4a6923..0d7f814786ba 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -32,9 +32,10 @@ protected PrivateEndpointConnectionsOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal PrivateEndpointConnectionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal PrivateEndpointConnectionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new PrivateEndpointConnectionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new PrivateEndpointConnectionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -44,7 +45,7 @@ internal PrivateEndpointConnectionsOperations(ClientDiagnostics clientDiagnostic /// Cosmos DB database account name. /// The name of the private endpoint connection. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.Get"); scope.Start(); @@ -64,7 +65,7 @@ public virtual async Task> GetA /// Cosmos DB database account name. /// The name of the private endpoint connection. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.Get"); scope.Start(); @@ -84,7 +85,7 @@ public virtual Response Get(string resou /// Cosmos DB database account name. /// The cancellation token to use. /// or is null. - public virtual AsyncPageable ListByDatabaseAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListByDatabaseAccountAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -95,7 +96,7 @@ public virtual AsyncPageable ListByDatab throw new ArgumentNullException(nameof(accountName)); } - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.ListByDatabaseAccount"); scope.Start(); @@ -118,7 +119,7 @@ async Task> FirstPageFunc(int? page /// Cosmos DB database account name. /// The cancellation token to use. /// or is null. - public virtual Pageable ListByDatabaseAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + public virtual Pageable ListByDatabaseAccount(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -129,7 +130,7 @@ public virtual Pageable ListByDatabaseAc throw new ArgumentNullException(nameof(accountName)); } - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("PrivateEndpointConnectionsOperations.ListByDatabaseAccount"); scope.Start(); @@ -151,10 +152,10 @@ Page FirstPageFunc(int? pageSizeHint) /// The name of the resource group. The name is case insensitive. /// Cosmos DB database account name. /// The name of the private endpoint connection. - /// The PrivateEndpointConnectionAutoGenerated to use. + /// The PrivateEndpointConnection to use. /// The cancellation token to use. /// , , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters, CancellationToken cancellationToken = default) + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -191,10 +192,10 @@ public virtual async Task Sta /// The name of the resource group. The name is case insensitive. /// Cosmos DB database account name. /// The name of the private endpoint connection. - /// The PrivateEndpointConnectionAutoGenerated to use. + /// The PrivateEndpointConnection to use. /// The cancellation token to use. /// , , , or is null. - public virtual PrivateEndpointConnectionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters, CancellationToken cancellationToken = default) + public virtual PrivateEndpointConnectionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsRestOperations.cs index 605cbf0c82ef..0d1d738e2b83 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateEndpointConnectionsRestOperations.cs @@ -20,6 +20,7 @@ internal partial class PrivateEndpointConnectionsRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class PrivateEndpointConnectionsRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public PrivateEndpointConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public PrivateEndpointConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListByDatabaseAccountRequest(string resourceGroupName uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/privateEndpointConnections", false); - uri.AppendQuery("api-version", "2019-08-01-preview", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +149,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string accountNa uri.AppendPath(accountName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", "2019-08-01-preview", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -154,7 +161,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string accountNa /// The name of the private endpoint connection. /// The cancellation token to use. /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -175,9 +182,9 @@ public async Task> GetAsync(str { case 200: { - PrivateEndpointConnectionAutoGenerated value = default; + PrivateEndpointConnection value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(document.RootElement); + value = PrivateEndpointConnection.DeserializePrivateEndpointConnection(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -191,7 +198,7 @@ public async Task> GetAsync(str /// The name of the private endpoint connection. /// The cancellation token to use. /// , , or is null. - public Response Get(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -212,9 +219,9 @@ public Response Get(string resourceGroup { case 200: { - PrivateEndpointConnectionAutoGenerated value = default; + PrivateEndpointConnection value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = PrivateEndpointConnectionAutoGenerated.DeserializePrivateEndpointConnectionAutoGenerated(document.RootElement); + value = PrivateEndpointConnection.DeserializePrivateEndpointConnection(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -222,7 +229,7 @@ public Response Get(string resourceGroup } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters) + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -237,7 +244,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(accountName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", "2019-08-01-preview", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -251,10 +258,10 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin /// The name of the resource group. The name is case insensitive. /// Cosmos DB database account name. /// The name of the private endpoint connection. - /// The PrivateEndpointConnectionAutoGenerated to use. + /// The PrivateEndpointConnection to use. /// The cancellation token to use. /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -289,10 +296,10 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string /// The name of the resource group. The name is case insensitive. /// Cosmos DB database account name. /// The name of the private endpoint connection. - /// The PrivateEndpointConnectionAutoGenerated to use. + /// The PrivateEndpointConnection to use. /// The cancellation token to use. /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnectionAutoGenerated parameters, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -338,7 +345,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accoun uri.AppendPath(accountName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", "2019-08-01-preview", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesOperations.cs index a78cd3a32876..b51fb17a3e3f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesOperations.cs @@ -32,9 +32,10 @@ protected PrivateLinkResourcesOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal PrivateLinkResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal PrivateLinkResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new PrivateLinkResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new PrivateLinkResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesRestOperations.cs index dfb50b476877..bdc52330c451 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/PrivateLinkResourcesRestOperations.cs @@ -20,6 +20,7 @@ internal partial class PrivateLinkResourcesRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class PrivateLinkResourcesRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public PrivateLinkResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public PrivateLinkResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListByDatabaseAccountRequest(string resourceGroupName uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", "2019-08-01-preview", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +149,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string accountNa uri.AppendPath(accountName, true); uri.AppendPath("/privateLinkResources/", false); uri.AppendPath(groupName, true); - uri.AppendQuery("api-version", "2019-08-01-preview", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations.cs index 7c76c3f0e1b6..c3fdfe7a2dfe 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations.cs @@ -19,6 +19,7 @@ namespace Azure.ResourceManager.CosmosDB internal partial class RestOperations { private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -26,11 +27,18 @@ internal partial class RestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// server parameter. - public RestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + /// Api Version. + /// is null. + public RestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -43,7 +51,7 @@ internal HttpMessage CreateListRequest() var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/providers/Microsoft.DocumentDB/operations", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableDatabaseAccountsOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableDatabaseAccountsOperations.cs new file mode 100644 index 000000000000..783cadb5f115 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableDatabaseAccountsOperations.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The RestorableDatabaseAccounts service client. + public partial class RestorableDatabaseAccountsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RestorableDatabaseAccountsRestOperations RestClient { get; } + + /// Initializes a new instance of RestorableDatabaseAccountsOperations for mocking. + protected RestorableDatabaseAccountsOperations() + { + } + + /// Initializes a new instance of RestorableDatabaseAccountsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal RestorableDatabaseAccountsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new RestorableDatabaseAccountsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + public virtual async Task> GetByLocationAsync(string location, string instanceId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("RestorableDatabaseAccountsOperations.GetByLocation"); + scope.Start(); + try + { + return await RestClient.GetByLocationAsync(location, instanceId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + public virtual Response GetByLocation(string location, string instanceId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("RestorableDatabaseAccountsOperations.GetByLocation"); + scope.Start(); + try + { + return RestClient.GetByLocation(location, instanceId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + /// is null. + public virtual AsyncPageable ListByLocationAsync(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableDatabaseAccountsOperations.ListByLocation"); + scope.Start(); + try + { + var response = await RestClient.ListByLocationAsync(location, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + /// is null. + public virtual Pageable ListByLocation(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableDatabaseAccountsOperations.ListByLocation"); + scope.Start(); + try + { + var response = RestClient.ListByLocation(location, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableDatabaseAccountsOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableDatabaseAccountsOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableDatabaseAccountsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableDatabaseAccountsRestOperations.cs new file mode 100644 index 000000000000..ec4bca980039 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableDatabaseAccountsRestOperations.cs @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class RestorableDatabaseAccountsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RestorableDatabaseAccountsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public RestorableDatabaseAccountsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByLocationRequest(string location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/restorableDatabaseAccounts", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + /// is null. + public async Task> ListByLocationAsync(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateListByLocationRequest(location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableDatabaseAccountsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableDatabaseAccountsListResult.DeserializeRestorableDatabaseAccountsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + /// is null. + public Response ListByLocation(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateListByLocationRequest(location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableDatabaseAccountsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableDatabaseAccountsListResult.DeserializeRestorableDatabaseAccountsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/restorableDatabaseAccounts", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableDatabaseAccountsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableDatabaseAccountsListResult.DeserializeRestorableDatabaseAccountsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableDatabaseAccountsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableDatabaseAccountsListResult.DeserializeRestorableDatabaseAccountsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetByLocationRequest(string location, string instanceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/restorableDatabaseAccounts/", false); + uri.AppendPath(instanceId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public async Task> GetByLocationAsync(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateGetByLocationRequest(location, instanceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableDatabaseAccountGetResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableDatabaseAccountGetResult.DeserializeRestorableDatabaseAccountGetResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public Response GetByLocation(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateGetByLocationRequest(location, instanceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableDatabaseAccountGetResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableDatabaseAccountGetResult.DeserializeRestorableDatabaseAccountGetResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbCollectionsOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbCollectionsOperations.cs new file mode 100644 index 000000000000..f6d43bf65a11 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbCollectionsOperations.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The RestorableMongodbCollections service client. + public partial class RestorableMongodbCollectionsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RestorableMongodbCollectionsRestOperations RestClient { get; } + + /// Initializes a new instance of RestorableMongodbCollectionsOperations for mocking. + protected RestorableMongodbCollectionsOperations() + { + } + + /// Initializes a new instance of RestorableMongodbCollectionsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal RestorableMongodbCollectionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new RestorableMongodbCollectionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The resource ID of the MongoDB database. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListAsync(string location, string instanceId, string restorableMongodbDatabaseRid = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableMongodbCollectionsOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(location, instanceId, restorableMongodbDatabaseRid, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The resource ID of the MongoDB database. + /// The cancellation token to use. + /// or is null. + public virtual Pageable List(string location, string instanceId, string restorableMongodbDatabaseRid = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableMongodbCollectionsOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(location, instanceId, restorableMongodbDatabaseRid, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbCollectionsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbCollectionsRestOperations.cs new file mode 100644 index 000000000000..36e433f3eab2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbCollectionsRestOperations.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class RestorableMongodbCollectionsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RestorableMongodbCollectionsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public RestorableMongodbCollectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest(string location, string instanceId, string restorableMongodbDatabaseRid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/restorableDatabaseAccounts/", false); + uri.AppendPath(instanceId, true); + uri.AppendPath("/restorableMongodbCollections", false); + uri.AppendQuery("api-version", apiVersion, true); + if (restorableMongodbDatabaseRid != null) + { + uri.AppendQuery("restorableMongodbDatabaseRid", restorableMongodbDatabaseRid, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The resource ID of the MongoDB database. + /// The cancellation token to use. + /// or is null. + public async Task> ListAsync(string location, string instanceId, string restorableMongodbDatabaseRid = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId, restorableMongodbDatabaseRid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableMongodbCollectionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableMongodbCollectionsListResult.DeserializeRestorableMongodbCollectionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The resource ID of the MongoDB database. + /// The cancellation token to use. + /// or is null. + public Response List(string location, string instanceId, string restorableMongodbDatabaseRid = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId, restorableMongodbDatabaseRid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableMongodbCollectionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableMongodbCollectionsListResult.DeserializeRestorableMongodbCollectionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbDatabasesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbDatabasesOperations.cs new file mode 100644 index 000000000000..d6b1312481c2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbDatabasesOperations.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The RestorableMongodbDatabases service client. + public partial class RestorableMongodbDatabasesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RestorableMongodbDatabasesRestOperations RestClient { get; } + + /// Initializes a new instance of RestorableMongodbDatabasesOperations for mocking. + protected RestorableMongodbDatabasesOperations() + { + } + + /// Initializes a new instance of RestorableMongodbDatabasesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal RestorableMongodbDatabasesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new RestorableMongodbDatabasesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListAsync(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableMongodbDatabasesOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(location, instanceId, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public virtual Pageable List(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableMongodbDatabasesOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(location, instanceId, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbDatabasesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbDatabasesRestOperations.cs new file mode 100644 index 000000000000..188d232e2fa1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbDatabasesRestOperations.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class RestorableMongodbDatabasesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RestorableMongodbDatabasesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public RestorableMongodbDatabasesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest(string location, string instanceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/restorableDatabaseAccounts/", false); + uri.AppendPath(instanceId, true); + uri.AppendPath("/restorableMongodbDatabases", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public async Task> ListAsync(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableMongodbDatabasesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableMongodbDatabasesListResult.DeserializeRestorableMongodbDatabasesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public Response List(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableMongodbDatabasesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableMongodbDatabasesListResult.DeserializeRestorableMongodbDatabasesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbResourcesOperations.cs new file mode 100644 index 000000000000..99fde4a8f5b8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbResourcesOperations.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The RestorableMongodbResources service client. + public partial class RestorableMongodbResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RestorableMongodbResourcesRestOperations RestClient { get; } + + /// Initializes a new instance of RestorableMongodbResourcesOperations for mocking. + protected RestorableMongodbResourcesOperations() + { + } + + /// Initializes a new instance of RestorableMongodbResourcesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal RestorableMongodbResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new RestorableMongodbResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Return a list of database and collection combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The location where the restorable resources are located. + /// The timestamp when the restorable resources existed. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListAsync(string location, string instanceId, string restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableMongodbResourcesOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Return a list of database and collection combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The location where the restorable resources are located. + /// The timestamp when the restorable resources existed. + /// The cancellation token to use. + /// or is null. + public virtual Pageable List(string location, string instanceId, string restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableMongodbResourcesOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(location, instanceId, restoreLocation, restoreTimestampInUtc, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbResourcesRestOperations.cs new file mode 100644 index 000000000000..3adc358e65ac --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableMongodbResourcesRestOperations.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class RestorableMongodbResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RestorableMongodbResourcesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public RestorableMongodbResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest(string location, string instanceId, string restoreLocation, string restoreTimestampInUtc) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/restorableDatabaseAccounts/", false); + uri.AppendPath(instanceId, true); + uri.AppendPath("/restorableMongodbResources", false); + uri.AppendQuery("api-version", apiVersion, true); + if (restoreLocation != null) + { + uri.AppendQuery("restoreLocation", restoreLocation, true); + } + if (restoreTimestampInUtc != null) + { + uri.AppendQuery("restoreTimestampInUtc", restoreTimestampInUtc, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Return a list of database and collection combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The location where the restorable resources are located. + /// The timestamp when the restorable resources existed. + /// The cancellation token to use. + /// or is null. + public async Task> ListAsync(string location, string instanceId, string restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId, restoreLocation, restoreTimestampInUtc); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableMongodbResourcesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableMongodbResourcesListResult.DeserializeRestorableMongodbResourcesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Return a list of database and collection combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The location where the restorable resources are located. + /// The timestamp when the restorable resources existed. + /// The cancellation token to use. + /// or is null. + public Response List(string location, string instanceId, string restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId, restoreLocation, restoreTimestampInUtc); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableMongodbResourcesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableMongodbResourcesListResult.DeserializeRestorableMongodbResourcesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlContainersOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlContainersOperations.cs new file mode 100644 index 000000000000..7453e5888752 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlContainersOperations.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The RestorableSqlContainers service client. + public partial class RestorableSqlContainersOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RestorableSqlContainersRestOperations RestClient { get; } + + /// Initializes a new instance of RestorableSqlContainersOperations for mocking. + protected RestorableSqlContainersOperations() + { + } + + /// Initializes a new instance of RestorableSqlContainersOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal RestorableSqlContainersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new RestorableSqlContainersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The resource ID of the SQL database. + /// The snapshot create timestamp after which snapshots need to be listed. + /// The snapshot create timestamp before which snapshots need to be listed. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListAsync(string location, string instanceId, string restorableSqlDatabaseRid = null, string startTime = null, string endTime = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableSqlContainersOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The resource ID of the SQL database. + /// The snapshot create timestamp after which snapshots need to be listed. + /// The snapshot create timestamp before which snapshots need to be listed. + /// The cancellation token to use. + /// or is null. + public virtual Pageable List(string location, string instanceId, string restorableSqlDatabaseRid = null, string startTime = null, string endTime = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableSqlContainersOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(location, instanceId, restorableSqlDatabaseRid, startTime, endTime, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlContainersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlContainersRestOperations.cs new file mode 100644 index 000000000000..eb3d336df20b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlContainersRestOperations.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class RestorableSqlContainersRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RestorableSqlContainersRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public RestorableSqlContainersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest(string location, string instanceId, string restorableSqlDatabaseRid, string startTime, string endTime) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/restorableDatabaseAccounts/", false); + uri.AppendPath(instanceId, true); + uri.AppendPath("/restorableSqlContainers", false); + uri.AppendQuery("api-version", apiVersion, true); + if (restorableSqlDatabaseRid != null) + { + uri.AppendQuery("restorableSqlDatabaseRid", restorableSqlDatabaseRid, true); + } + if (startTime != null) + { + uri.AppendQuery("startTime", startTime, true); + } + if (endTime != null) + { + uri.AppendQuery("endTime", endTime, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The resource ID of the SQL database. + /// The snapshot create timestamp after which snapshots need to be listed. + /// The snapshot create timestamp before which snapshots need to be listed. + /// The cancellation token to use. + /// or is null. + public async Task> ListAsync(string location, string instanceId, string restorableSqlDatabaseRid = null, string startTime = null, string endTime = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId, restorableSqlDatabaseRid, startTime, endTime); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableSqlContainersListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableSqlContainersListResult.DeserializeRestorableSqlContainersListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The resource ID of the SQL database. + /// The snapshot create timestamp after which snapshots need to be listed. + /// The snapshot create timestamp before which snapshots need to be listed. + /// The cancellation token to use. + /// or is null. + public Response List(string location, string instanceId, string restorableSqlDatabaseRid = null, string startTime = null, string endTime = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId, restorableSqlDatabaseRid, startTime, endTime); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableSqlContainersListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableSqlContainersListResult.DeserializeRestorableSqlContainersListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlDatabasesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlDatabasesOperations.cs new file mode 100644 index 000000000000..8ca8f08cf292 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlDatabasesOperations.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The RestorableSqlDatabases service client. + public partial class RestorableSqlDatabasesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RestorableSqlDatabasesRestOperations RestClient { get; } + + /// Initializes a new instance of RestorableSqlDatabasesOperations for mocking. + protected RestorableSqlDatabasesOperations() + { + } + + /// Initializes a new instance of RestorableSqlDatabasesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal RestorableSqlDatabasesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new RestorableSqlDatabasesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListAsync(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableSqlDatabasesOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(location, instanceId, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public virtual Pageable List(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableSqlDatabasesOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(location, instanceId, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlDatabasesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlDatabasesRestOperations.cs new file mode 100644 index 000000000000..895b2c547dc6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlDatabasesRestOperations.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class RestorableSqlDatabasesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RestorableSqlDatabasesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public RestorableSqlDatabasesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest(string location, string instanceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/restorableDatabaseAccounts/", false); + uri.AppendPath(instanceId, true); + uri.AppendPath("/restorableSqlDatabases", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public async Task> ListAsync(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableSqlDatabasesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableSqlDatabasesListResult.DeserializeRestorableSqlDatabasesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The cancellation token to use. + /// or is null. + public Response List(string location, string instanceId, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableSqlDatabasesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableSqlDatabasesListResult.DeserializeRestorableSqlDatabasesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlResourcesOperations.cs new file mode 100644 index 000000000000..22573350e03d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlResourcesOperations.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The RestorableSqlResources service client. + public partial class RestorableSqlResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RestorableSqlResourcesRestOperations RestClient { get; } + + /// Initializes a new instance of RestorableSqlResourcesOperations for mocking. + protected RestorableSqlResourcesOperations() + { + } + + /// Initializes a new instance of RestorableSqlResourcesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal RestorableSqlResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new RestorableSqlResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The location where the restorable resources are located. + /// The timestamp when the restorable resources existed. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListAsync(string location, string instanceId, string restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableSqlResourcesOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(location, instanceId, restoreLocation, restoreTimestampInUtc, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The location where the restorable resources are located. + /// The timestamp when the restorable resources existed. + /// The cancellation token to use. + /// or is null. + public virtual Pageable List(string location, string instanceId, string restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableSqlResourcesOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(location, instanceId, restoreLocation, restoreTimestampInUtc, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlResourcesRestOperations.cs new file mode 100644 index 000000000000..7e2f8bff46dd --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableSqlResourcesRestOperations.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class RestorableSqlResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RestorableSqlResourcesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public RestorableSqlResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest(string location, string instanceId, string restoreLocation, string restoreTimestampInUtc) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/restorableDatabaseAccounts/", false); + uri.AppendPath(instanceId, true); + uri.AppendPath("/restorableSqlResources", false); + uri.AppendQuery("api-version", apiVersion, true); + if (restoreLocation != null) + { + uri.AppendQuery("restoreLocation", restoreLocation, true); + } + if (restoreTimestampInUtc != null) + { + uri.AppendQuery("restoreTimestampInUtc", restoreTimestampInUtc, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The location where the restorable resources are located. + /// The timestamp when the restorable resources existed. + /// The cancellation token to use. + /// or is null. + public async Task> ListAsync(string location, string instanceId, string restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId, restoreLocation, restoreTimestampInUtc); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableSqlResourcesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableSqlResourcesListResult.DeserializeRestorableSqlResourcesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate what resources exist at given timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The instanceId GUID of a restorable database account. + /// The location where the restorable resources are located. + /// The timestamp when the restorable resources existed. + /// The cancellation token to use. + /// or is null. + public Response List(string location, string instanceId, string restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + if (instanceId == null) + { + throw new ArgumentNullException(nameof(instanceId)); + } + + using var message = CreateListRequest(location, instanceId, restoreLocation, restoreTimestampInUtc); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableSqlResourcesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableSqlResourcesListResult.DeserializeRestorableSqlResourcesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceCreateOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceCreateOperation.cs new file mode 100644 index 000000000000..c87e3653887c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceCreateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Creates a service. + public partial class ServiceCreateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ServiceCreateOperation for mocking. + protected ServiceCreateOperation() + { + } + + internal ServiceCreateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServiceCreateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ServiceResource Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ServiceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ServiceResource.DeserializeServiceResource(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ServiceResource.DeserializeServiceResource(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceDeleteOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceDeleteOperation.cs new file mode 100644 index 000000000000..d3d5613ae84b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceDeleteOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Deletes service with the given serviceName. + public partial class ServiceDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ServiceDeleteOperation for mocking. + protected ServiceDeleteOperation() + { + } + + internal ServiceDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServiceDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceOperations.cs new file mode 100644 index 000000000000..0e814b7f76de --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceOperations.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// The Service service client. + public partial class ServiceOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ServiceRestOperations RestClient { get; } + + /// Initializes a new instance of ServiceOperations for mocking. + protected ServiceOperations() + { + } + + /// Initializes a new instance of ServiceOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + internal ServiceOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + RestClient = new ServiceRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the status of service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string accountName, string serviceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServiceOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, accountName, serviceName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the status of service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string accountName, string serviceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServiceOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, accountName, serviceName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the status of service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServiceOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Gets the status of service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable List(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServiceOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Creates a service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The Service resource parameters. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateAsync(string resourceGroupName, string accountName, string serviceName, ServiceResourceCreateUpdateParameters createUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + if (createUpdateParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ServiceOperations.StartCreate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateAsync(resourceGroupName, accountName, serviceName, createUpdateParameters, cancellationToken).ConfigureAwait(false); + return new ServiceCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateRequest(resourceGroupName, accountName, serviceName, createUpdateParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The Service resource parameters. + /// The cancellation token to use. + /// , , , or is null. + public virtual ServiceCreateOperation StartCreate(string resourceGroupName, string accountName, string serviceName, ServiceResourceCreateUpdateParameters createUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + if (createUpdateParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ServiceOperations.StartCreate"); + scope.Start(); + try + { + var originalResponse = RestClient.Create(resourceGroupName, accountName, serviceName, createUpdateParameters, cancellationToken); + return new ServiceCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateRequest(resourceGroupName, accountName, serviceName, createUpdateParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes service with the given serviceName. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string accountName, string serviceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + + using var scope = _clientDiagnostics.CreateScope("ServiceOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, accountName, serviceName, cancellationToken).ConfigureAwait(false); + return new ServiceDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, accountName, serviceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes service with the given serviceName. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The cancellation token to use. + /// , , or is null. + public virtual ServiceDeleteOperation StartDelete(string resourceGroupName, string accountName, string serviceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + + using var scope = _clientDiagnostics.CreateScope("ServiceOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, accountName, serviceName, cancellationToken); + return new ServiceDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, accountName, serviceName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceRestOperations.cs new file mode 100644 index 000000000000..fdc1522b73a7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ServiceRestOperations.cs @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + internal partial class ServiceRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ServiceRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public ServiceRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = apiVersion; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest(string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/services", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the status of service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceResourceListResult.DeserializeServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the status of service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response List(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceResourceListResult.DeserializeServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string resourceGroupName, string accountName, string serviceName, ServiceResourceCreateUpdateParameters createUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/services/", false); + uri.AppendPath(serviceName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateParameters); + request.Content = content; + return message; + } + + /// Creates a service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The Service resource parameters. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateAsync(string resourceGroupName, string accountName, string serviceName, ServiceResourceCreateUpdateParameters createUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + if (createUpdateParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateParameters)); + } + + using var message = CreateCreateRequest(resourceGroupName, accountName, serviceName, createUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The Service resource parameters. + /// The cancellation token to use. + /// , , , or is null. + public Response Create(string resourceGroupName, string accountName, string serviceName, ServiceResourceCreateUpdateParameters createUpdateParameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + if (createUpdateParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateParameters)); + } + + using var message = CreateCreateRequest(resourceGroupName, accountName, serviceName, createUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string accountName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/services/", false); + uri.AppendPath(serviceName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the status of service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string accountName, string serviceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServiceResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceResource.DeserializeServiceResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the status of service. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string accountName, string serviceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + + using var message = CreateGetRequest(resourceGroupName, accountName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServiceResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceResource.DeserializeServiceResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accountName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/services/", false); + uri.AppendPath(serviceName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Deletes service with the given serviceName. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string accountName, string serviceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, accountName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes service with the given serviceName. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB service name. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string accountName, string serviceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (serviceName == null) + { + throw new ArgumentNullException(nameof(serviceName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, accountName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlRoleAssignmentOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlRoleAssignmentOperation.cs new file mode 100644 index 000000000000..c6db9cb80c43 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlRoleAssignmentOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Creates or updates an Azure Cosmos DB SQL Role Assignment. + public partial class SqlResourcesCreateUpdateSqlRoleAssignmentOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of SqlResourcesCreateUpdateSqlRoleAssignmentOperation for mocking. + protected SqlResourcesCreateUpdateSqlRoleAssignmentOperation() + { + } + + internal SqlResourcesCreateUpdateSqlRoleAssignmentOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesCreateUpdateSqlRoleAssignmentOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override SqlRoleAssignmentGetResults Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + SqlRoleAssignmentGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return SqlRoleAssignmentGetResults.DeserializeSqlRoleAssignmentGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return SqlRoleAssignmentGetResults.DeserializeSqlRoleAssignmentGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlRoleDefinitionOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlRoleDefinitionOperation.cs new file mode 100644 index 000000000000..2542a36bd90c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesCreateUpdateSqlRoleDefinitionOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Creates or updates an Azure Cosmos DB SQL Role Definition. + public partial class SqlResourcesCreateUpdateSqlRoleDefinitionOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of SqlResourcesCreateUpdateSqlRoleDefinitionOperation for mocking. + protected SqlResourcesCreateUpdateSqlRoleDefinitionOperation() + { + } + + internal SqlResourcesCreateUpdateSqlRoleDefinitionOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesCreateUpdateSqlRoleDefinitionOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override SqlRoleDefinitionGetResults Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + SqlRoleDefinitionGetResults IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return SqlRoleDefinitionGetResults.DeserializeSqlRoleDefinitionGetResults(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return SqlRoleDefinitionGetResults.DeserializeSqlRoleDefinitionGetResults(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlRoleAssignmentOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlRoleAssignmentOperation.cs new file mode 100644 index 000000000000..09ca5f6d7692 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlRoleAssignmentOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB SQL Role Assignment. + public partial class SqlResourcesDeleteSqlRoleAssignmentOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of SqlResourcesDeleteSqlRoleAssignmentOperation for mocking. + protected SqlResourcesDeleteSqlRoleAssignmentOperation() + { + } + + internal SqlResourcesDeleteSqlRoleAssignmentOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesDeleteSqlRoleAssignmentOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlRoleDefinitionOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlRoleDefinitionOperation.cs new file mode 100644 index 000000000000..3cac3ace07f9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesDeleteSqlRoleDefinitionOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Deletes an existing Azure Cosmos DB SQL Role Definition. + public partial class SqlResourcesDeleteSqlRoleDefinitionOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of SqlResourcesDeleteSqlRoleDefinitionOperation for mocking. + protected SqlResourcesDeleteSqlRoleDefinitionOperation() + { + } + + internal SqlResourcesDeleteSqlRoleDefinitionOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesDeleteSqlRoleDefinitionOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesOperations.cs index 74e128761bb1..9aebebfd3146 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesOperations.cs @@ -32,9 +32,10 @@ protected SqlResourcesOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal SqlResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal SqlResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new SqlResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new SqlResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -335,6 +336,86 @@ public virtual Response GetSqlTrigger(string resourceGroup } } + /// Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual async Task> GetSqlRoleDefinitionAsync(string roleDefinitionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlRoleDefinition"); + scope.Start(); + try + { + return await RestClient.GetSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual Response GetSqlRoleDefinition(string roleDefinitionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlRoleDefinition"); + scope.Start(); + try + { + return RestClient.GetSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual async Task> GetSqlRoleAssignmentAsync(string roleAssignmentId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlRoleAssignment"); + scope.Start(); + try + { + return await RestClient.GetSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + public virtual Response GetSqlRoleAssignment(string roleAssignmentId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.GetSqlRoleAssignment"); + scope.Start(); + try + { + return RestClient.GetSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Lists the SQL databases under an existing Azure Cosmos DB database account. /// The name of the resource group. The name is case insensitive. /// Cosmos DB database account name. @@ -745,6 +826,142 @@ Page FirstPageFunc(int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, null); } + /// Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListSqlRoleDefinitionsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlRoleDefinitions"); + scope.Start(); + try + { + var response = await RestClient.ListSqlRoleDefinitionsAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListSqlRoleDefinitions(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlRoleDefinitions"); + scope.Start(); + try + { + var response = RestClient.ListSqlRoleDefinitions(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListSqlRoleAssignmentsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlRoleAssignments"); + scope.Start(); + try + { + var response = await RestClient.ListSqlRoleAssignmentsAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListSqlRoleAssignments(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.ListSqlRoleAssignments"); + scope.Start(); + try + { + var response = RestClient.ListSqlRoleAssignments(resourceGroupName, accountName, cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + /// Create or update an Azure Cosmos DB SQL database. /// The name of the resource group. The name is case insensitive. /// Cosmos DB database account name. @@ -2104,5 +2321,395 @@ public virtual SqlResourcesDeleteSqlTriggerOperation StartDeleteSqlTrigger(strin throw; } } + + /// Creates or updates an Azure Cosmos DB SQL Role Definition. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The properties required to create or update a Role Definition. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateSqlRoleDefinitionAsync(string roleDefinitionId, string resourceGroupName, string accountName, SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateSqlRoleDefinitionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlRoleDefinitionParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlRoleDefinition"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesCreateUpdateSqlRoleDefinitionOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an Azure Cosmos DB SQL Role Definition. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The properties required to create or update a Role Definition. + /// The cancellation token to use. + /// , , , or is null. + public virtual SqlResourcesCreateUpdateSqlRoleDefinitionOperation StartCreateUpdateSqlRoleDefinition(string roleDefinitionId, string resourceGroupName, string accountName, SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateSqlRoleDefinitionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlRoleDefinitionParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlRoleDefinition"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters, cancellationToken); + return new SqlResourcesCreateUpdateSqlRoleDefinitionOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL Role Definition. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteSqlRoleDefinitionAsync(string roleDefinitionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlRoleDefinition"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteSqlRoleDefinitionAsync(roleDefinitionId, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesDeleteSqlRoleDefinitionOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL Role Definition. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public virtual SqlResourcesDeleteSqlRoleDefinitionOperation StartDeleteSqlRoleDefinition(string roleDefinitionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlRoleDefinition"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteSqlRoleDefinition(roleDefinitionId, resourceGroupName, accountName, cancellationToken); + return new SqlResourcesDeleteSqlRoleDefinitionOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an Azure Cosmos DB SQL Role Assignment. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The properties required to create or update a Role Assignment. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateUpdateSqlRoleAssignmentAsync(string roleAssignmentId, string resourceGroupName, string accountName, SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateSqlRoleAssignmentParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlRoleAssignmentParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlRoleAssignment"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateUpdateSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, cancellationToken).ConfigureAwait(false); + return new SqlResourcesCreateUpdateSqlRoleAssignmentOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates an Azure Cosmos DB SQL Role Assignment. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The properties required to create or update a Role Assignment. + /// The cancellation token to use. + /// , , , or is null. + public virtual SqlResourcesCreateUpdateSqlRoleAssignmentOperation StartCreateUpdateSqlRoleAssignment(string roleAssignmentId, string resourceGroupName, string accountName, SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateSqlRoleAssignmentParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlRoleAssignmentParameters)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartCreateUpdateSqlRoleAssignment"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateUpdateSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters, cancellationToken); + return new SqlResourcesCreateUpdateSqlRoleAssignmentOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateUpdateSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL Role Assignment. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteSqlRoleAssignmentAsync(string roleAssignmentId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlRoleAssignment"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteSqlRoleAssignmentAsync(roleAssignmentId, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return new SqlResourcesDeleteSqlRoleAssignmentOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing Azure Cosmos DB SQL Role Assignment. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public virtual SqlResourcesDeleteSqlRoleAssignmentOperation StartDeleteSqlRoleAssignment(string roleAssignmentId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartDeleteSqlRoleAssignment"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteSqlRoleAssignment(roleAssignmentId, resourceGroupName, accountName, cancellationToken); + return new SqlResourcesDeleteSqlRoleAssignmentOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves continuous backup information for a container resource. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The name of the continuous backup restore location. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartRetrieveContinuousBackupInformationAsync(string resourceGroupName, string accountName, string databaseName, string containerName, ContinuousBackupRestoreLocation location, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartRetrieveContinuousBackupInformation"); + scope.Start(); + try + { + var originalResponse = await RestClient.RetrieveContinuousBackupInformationAsync(resourceGroupName, accountName, databaseName, containerName, location, cancellationToken).ConfigureAwait(false); + return new SqlResourcesRetrieveContinuousBackupInformationOperation(_clientDiagnostics, _pipeline, RestClient.CreateRetrieveContinuousBackupInformationRequest(resourceGroupName, accountName, databaseName, containerName, location).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves continuous backup information for a container resource. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The name of the continuous backup restore location. + /// The cancellation token to use. + /// , , , , or is null. + public virtual SqlResourcesRetrieveContinuousBackupInformationOperation StartRetrieveContinuousBackupInformation(string resourceGroupName, string accountName, string databaseName, string containerName, ContinuousBackupRestoreLocation location, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var scope = _clientDiagnostics.CreateScope("SqlResourcesOperations.StartRetrieveContinuousBackupInformation"); + scope.Start(); + try + { + var originalResponse = RestClient.RetrieveContinuousBackupInformation(resourceGroupName, accountName, databaseName, containerName, location, cancellationToken); + return new SqlResourcesRetrieveContinuousBackupInformationOperation(_clientDiagnostics, _pipeline, RestClient.CreateRetrieveContinuousBackupInformationRequest(resourceGroupName, accountName, databaseName, containerName, location).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRestOperations.cs index 1518427bc85e..eb4c0fb7ad7a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRestOperations.cs @@ -20,6 +20,7 @@ internal partial class SqlResourcesRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class SqlResourcesRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public SqlResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public SqlResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListSqlDatabasesRequest(string resourceGroupName, str uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/sqlDatabases", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +149,7 @@ internal HttpMessage CreateGetSqlDatabaseRequest(string resourceGroupName, strin uri.AppendPath(accountName, true); uri.AppendPath("/sqlDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -237,7 +244,7 @@ internal HttpMessage CreateCreateUpdateSqlDatabaseRequest(string resourceGroupNa uri.AppendPath(accountName, true); uri.AppendPath("/sqlDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -338,7 +345,7 @@ internal HttpMessage CreateDeleteSqlDatabaseRequest(string resourceGroupName, st uri.AppendPath(accountName, true); uri.AppendPath("/sqlDatabases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -425,7 +432,7 @@ internal HttpMessage CreateGetSqlDatabaseThroughputRequest(string resourceGroupN uri.AppendPath("/sqlDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -521,7 +528,7 @@ internal HttpMessage CreateUpdateSqlDatabaseThroughputRequest(string resourceGro uri.AppendPath("/sqlDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -623,7 +630,7 @@ internal HttpMessage CreateMigrateSqlDatabaseToAutoscaleRequest(string resourceG uri.AppendPath("/sqlDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -711,7 +718,7 @@ internal HttpMessage CreateMigrateSqlDatabaseToManualThroughputRequest(string re uri.AppendPath("/sqlDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -799,7 +806,7 @@ internal HttpMessage CreateListSqlContainersRequest(string resourceGroupName, st uri.AppendPath("/sqlDatabases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/containers", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -896,7 +903,7 @@ internal HttpMessage CreateGetSqlContainerRequest(string resourceGroupName, stri uri.AppendPath(databaseName, true); uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1003,7 +1010,7 @@ internal HttpMessage CreateCreateUpdateSqlContainerRequest(string resourceGroupN uri.AppendPath(databaseName, true); uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1116,7 +1123,7 @@ internal HttpMessage CreateDeleteSqlContainerRequest(string resourceGroupName, s uri.AppendPath(databaseName, true); uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -1215,7 +1222,7 @@ internal HttpMessage CreateGetSqlContainerThroughputRequest(string resourceGroup uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1323,7 +1330,7 @@ internal HttpMessage CreateUpdateSqlContainerThroughputRequest(string resourceGr uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1437,7 +1444,7 @@ internal HttpMessage CreateMigrateSqlContainerToAutoscaleRequest(string resource uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1537,7 +1544,7 @@ internal HttpMessage CreateMigrateSqlContainerToManualThroughputRequest(string r uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1637,7 +1644,7 @@ internal HttpMessage CreateListSqlStoredProceduresRequest(string resourceGroupNa uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); uri.AppendPath("/storedProcedures", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1746,7 +1753,7 @@ internal HttpMessage CreateGetSqlStoredProcedureRequest(string resourceGroupName uri.AppendPath(containerName, true); uri.AppendPath("/storedProcedures/", false); uri.AppendPath(storedProcedureName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1865,7 +1872,7 @@ internal HttpMessage CreateCreateUpdateSqlStoredProcedureRequest(string resource uri.AppendPath(containerName, true); uri.AppendPath("/storedProcedures/", false); uri.AppendPath(storedProcedureName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1990,7 +1997,7 @@ internal HttpMessage CreateDeleteSqlStoredProcedureRequest(string resourceGroupN uri.AppendPath(containerName, true); uri.AppendPath("/storedProcedures/", false); uri.AppendPath(storedProcedureName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -2099,7 +2106,7 @@ internal HttpMessage CreateListSqlUserDefinedFunctionsRequest(string resourceGro uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); uri.AppendPath("/userDefinedFunctions", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -2208,7 +2215,7 @@ internal HttpMessage CreateGetSqlUserDefinedFunctionRequest(string resourceGroup uri.AppendPath(containerName, true); uri.AppendPath("/userDefinedFunctions/", false); uri.AppendPath(userDefinedFunctionName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -2327,7 +2334,7 @@ internal HttpMessage CreateCreateUpdateSqlUserDefinedFunctionRequest(string reso uri.AppendPath(containerName, true); uri.AppendPath("/userDefinedFunctions/", false); uri.AppendPath(userDefinedFunctionName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -2452,7 +2459,7 @@ internal HttpMessage CreateDeleteSqlUserDefinedFunctionRequest(string resourceGr uri.AppendPath(containerName, true); uri.AppendPath("/userDefinedFunctions/", false); uri.AppendPath(userDefinedFunctionName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -2561,7 +2568,7 @@ internal HttpMessage CreateListSqlTriggersRequest(string resourceGroupName, stri uri.AppendPath("/containers/", false); uri.AppendPath(containerName, true); uri.AppendPath("/triggers", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -2670,7 +2677,7 @@ internal HttpMessage CreateGetSqlTriggerRequest(string resourceGroupName, string uri.AppendPath(containerName, true); uri.AppendPath("/triggers/", false); uri.AppendPath(triggerName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -2789,7 +2796,7 @@ internal HttpMessage CreateCreateUpdateSqlTriggerRequest(string resourceGroupNam uri.AppendPath(containerName, true); uri.AppendPath("/triggers/", false); uri.AppendPath(triggerName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -2914,7 +2921,7 @@ internal HttpMessage CreateDeleteSqlTriggerRequest(string resourceGroupName, str uri.AppendPath(containerName, true); uri.AppendPath("/triggers/", false); uri.AppendPath(triggerName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -3004,5 +3011,857 @@ public Response DeleteSqlTrigger(string resourceGroupName, string accountName, s throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } + + internal HttpMessage CreateGetSqlRoleDefinitionRequest(string roleDefinitionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlRoleDefinitions/", false); + uri.AppendPath(roleDefinitionId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetSqlRoleDefinitionAsync(string roleDefinitionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlRoleDefinitionGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlRoleDefinitionGetResults.DeserializeSqlRoleDefinitionGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public Response GetSqlRoleDefinition(string roleDefinitionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlRoleDefinitionGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlRoleDefinitionGetResults.DeserializeSqlRoleDefinitionGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateSqlRoleDefinitionRequest(string roleDefinitionId, string resourceGroupName, string accountName, SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlRoleDefinitions/", false); + uri.AppendPath(roleDefinitionId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateSqlRoleDefinitionParameters); + request.Content = content; + return message; + } + + /// Creates or updates an Azure Cosmos DB SQL Role Definition. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The properties required to create or update a Role Definition. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateSqlRoleDefinitionAsync(string roleDefinitionId, string resourceGroupName, string accountName, SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateSqlRoleDefinitionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlRoleDefinitionParameters)); + } + + using var message = CreateCreateUpdateSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates or updates an Azure Cosmos DB SQL Role Definition. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The properties required to create or update a Role Definition. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdateSqlRoleDefinition(string roleDefinitionId, string resourceGroupName, string accountName, SqlRoleDefinitionCreateUpdateParameters createUpdateSqlRoleDefinitionParameters, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateSqlRoleDefinitionParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlRoleDefinitionParameters)); + } + + using var message = CreateCreateUpdateSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName, createUpdateSqlRoleDefinitionParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteSqlRoleDefinitionRequest(string roleDefinitionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlRoleDefinitions/", false); + uri.AppendPath(roleDefinitionId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Deletes an existing Azure Cosmos DB SQL Role Definition. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteSqlRoleDefinitionAsync(string roleDefinitionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateDeleteSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes an existing Azure Cosmos DB SQL Role Definition. + /// The GUID for the Role Definition. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteSqlRoleDefinition(string roleDefinitionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleDefinitionId == null) + { + throw new ArgumentNullException(nameof(roleDefinitionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateDeleteSqlRoleDefinitionRequest(roleDefinitionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSqlRoleDefinitionsRequest(string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlRoleDefinitions", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListSqlRoleDefinitionsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListSqlRoleDefinitionsRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlRoleDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlRoleDefinitionListResult.DeserializeSqlRoleDefinitionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListSqlRoleDefinitions(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListSqlRoleDefinitionsRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlRoleDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlRoleDefinitionListResult.DeserializeSqlRoleDefinitionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSqlRoleAssignmentRequest(string roleAssignmentId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlRoleAssignments/", false); + uri.AppendPath(roleAssignmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetSqlRoleAssignmentAsync(string roleAssignmentId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlRoleAssignmentGetResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlRoleAssignmentGetResults.DeserializeSqlRoleAssignmentGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public Response GetSqlRoleAssignment(string roleAssignmentId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateGetSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlRoleAssignmentGetResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlRoleAssignmentGetResults.DeserializeSqlRoleAssignmentGetResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateUpdateSqlRoleAssignmentRequest(string roleAssignmentId, string resourceGroupName, string accountName, SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlRoleAssignments/", false); + uri.AppendPath(roleAssignmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(createUpdateSqlRoleAssignmentParameters); + request.Content = content; + return message; + } + + /// Creates or updates an Azure Cosmos DB SQL Role Assignment. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The properties required to create or update a Role Assignment. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateUpdateSqlRoleAssignmentAsync(string roleAssignmentId, string resourceGroupName, string accountName, SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateSqlRoleAssignmentParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlRoleAssignmentParameters)); + } + + using var message = CreateCreateUpdateSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates or updates an Azure Cosmos DB SQL Role Assignment. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The properties required to create or update a Role Assignment. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateUpdateSqlRoleAssignment(string roleAssignmentId, string resourceGroupName, string accountName, SqlRoleAssignmentCreateUpdateParameters createUpdateSqlRoleAssignmentParameters, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (createUpdateSqlRoleAssignmentParameters == null) + { + throw new ArgumentNullException(nameof(createUpdateSqlRoleAssignmentParameters)); + } + + using var message = CreateCreateUpdateSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName, createUpdateSqlRoleAssignmentParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteSqlRoleAssignmentRequest(string roleAssignmentId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlRoleAssignments/", false); + uri.AppendPath(roleAssignmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Deletes an existing Azure Cosmos DB SQL Role Assignment. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteSqlRoleAssignmentAsync(string roleAssignmentId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateDeleteSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes an existing Azure Cosmos DB SQL Role Assignment. + /// The GUID for the Role Assignment. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteSqlRoleAssignment(string roleAssignmentId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (roleAssignmentId == null) + { + throw new ArgumentNullException(nameof(roleAssignmentId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateDeleteSqlRoleAssignmentRequest(roleAssignmentId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSqlRoleAssignmentsRequest(string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlRoleAssignments", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public async Task> ListSqlRoleAssignmentsAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListSqlRoleAssignmentsRequest(resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlRoleAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlRoleAssignmentListResult.DeserializeSqlRoleAssignmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves the list of all Azure Cosmos DB SQL Role Assignments. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// The cancellation token to use. + /// or is null. + public Response ListSqlRoleAssignments(string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + + using var message = CreateListSqlRoleAssignmentsRequest(resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlRoleAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlRoleAssignmentListResult.DeserializeSqlRoleAssignmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRetrieveContinuousBackupInformationRequest(string resourceGroupName, string accountName, string databaseName, string containerName, ContinuousBackupRestoreLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/sqlDatabases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/containers/", false); + uri.AppendPath(containerName, true); + uri.AppendPath("/retrieveContinuousBackupInformation", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(location); + request.Content = content; + return message; + } + + /// Retrieves continuous backup information for a container resource. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The name of the continuous backup restore location. + /// The cancellation token to use. + /// , , , , or is null. + public async Task RetrieveContinuousBackupInformationAsync(string resourceGroupName, string accountName, string databaseName, string containerName, ContinuousBackupRestoreLocation location, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateRetrieveContinuousBackupInformationRequest(resourceGroupName, accountName, databaseName, containerName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves continuous backup information for a container resource. + /// The name of the resource group. The name is case insensitive. + /// Cosmos DB database account name. + /// Cosmos DB database name. + /// Cosmos DB container name. + /// The name of the continuous backup restore location. + /// The cancellation token to use. + /// , , , , or is null. + public Response RetrieveContinuousBackupInformation(string resourceGroupName, string accountName, string databaseName, string containerName, ContinuousBackupRestoreLocation location, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (accountName == null) + { + throw new ArgumentNullException(nameof(accountName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (containerName == null) + { + throw new ArgumentNullException(nameof(containerName)); + } + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateRetrieveContinuousBackupInformationRequest(resourceGroupName, accountName, databaseName, containerName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRetrieveContinuousBackupInformationOperation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRetrieveContinuousBackupInformationOperation.cs new file mode 100644 index 000000000000..e049378bfe1a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/SqlResourcesRetrieveContinuousBackupInformationOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB +{ + /// Retrieves continuous backup information for a container resource. + public partial class SqlResourcesRetrieveContinuousBackupInformationOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of SqlResourcesRetrieveContinuousBackupInformationOperation for mocking. + protected SqlResourcesRetrieveContinuousBackupInformationOperation() + { + } + + internal SqlResourcesRetrieveContinuousBackupInformationOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "SqlResourcesRetrieveContinuousBackupInformationOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override BackupInformation Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + BackupInformation IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return BackupInformation.DeserializeBackupInformation(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return BackupInformation.DeserializeBackupInformation(document.RootElement); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesOperations.cs index 8b537569e46a..a7dd635daf2f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesOperations.cs @@ -32,9 +32,10 @@ protected TableResourcesOperations() /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - internal TableResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + internal TableResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { - RestClient = new TableResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new TableResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesRestOperations.cs index e8550154ce17..1d94c245afc2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/TableResourcesRestOperations.cs @@ -20,6 +20,7 @@ internal partial class TableResourcesRestOperations { private string subscriptionId; private Uri endpoint; + private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; @@ -28,17 +29,23 @@ internal partial class TableResourcesRestOperations /// The HTTP pipeline for sending and receiving REST requests and responses. /// The ID of the target subscription. /// server parameter. - /// is null. - public TableResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + /// Api Version. + /// or is null. + public TableResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-07-01-preview") { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } endpoint ??= new Uri("https://management.azure.com"); + if (apiVersion == null) + { + throw new ArgumentNullException(nameof(apiVersion)); + } this.subscriptionId = subscriptionId; this.endpoint = endpoint; + this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -57,7 +64,7 @@ internal HttpMessage CreateListTablesRequest(string resourceGroupName, string ac uri.AppendPath("/providers/Microsoft.DocumentDB/databaseAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/tables", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +149,7 @@ internal HttpMessage CreateGetTableRequest(string resourceGroupName, string acco uri.AppendPath(accountName, true); uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -237,7 +244,7 @@ internal HttpMessage CreateCreateUpdateTableRequest(string resourceGroupName, st uri.AppendPath(accountName, true); uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -338,7 +345,7 @@ internal HttpMessage CreateDeleteTableRequest(string resourceGroupName, string a uri.AppendPath(accountName, true); uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; return message; } @@ -425,7 +432,7 @@ internal HttpMessage CreateGetTableThroughputRequest(string resourceGroupName, s uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -521,7 +528,7 @@ internal HttpMessage CreateUpdateTableThroughputRequest(string resourceGroupName uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); uri.AppendPath("/throughputSettings/default", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -623,7 +630,7 @@ internal HttpMessage CreateMigrateTableToAutoscaleRequest(string resourceGroupNa uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); uri.AppendPath("/throughputSettings/default/migrateToAutoscale", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -711,7 +718,7 @@ internal HttpMessage CreateMigrateTableToManualThroughputRequest(string resource uri.AppendPath("/tables/", false); uri.AppendPath(tableName, true); uri.AppendPath("/throughputSettings/default/migrateToManualThroughput", false); - uri.AppendQuery("api-version", "2020-04-01", true); + uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md index 442d683a1a2f..b5cb2c1a9ef9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md @@ -5,8 +5,8 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/86f4c7c4403845651ab9c027f7aa6fa392fd935c/specification/cosmos-db/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/ef4690016b60a342aff3c9a4fcfbaf20e2301b4d/specification/cosmos-db/resource-manager/readme.md modelerfour: lenient-model-deduplication: true -``` \ No newline at end of file +```