diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ConfigurationStore.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ConfigurationStore.cs index 1768b7d3fd4d..d66e3ae928bf 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ConfigurationStore.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ConfigurationStore.cs @@ -522,21 +522,21 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Regenerates an access key for the specified configuration store. - /// The options for regenerating an access key. + /// The parameters for regenerating an access key. /// The cancellation token to use. - /// is null. - public async virtual Task> RegenerateKeyAsync(RegenerateKeyOptions regenerateKeyOptions, CancellationToken cancellationToken = default) + /// is null. + public async virtual Task> RegenerateKeyAsync(RegenerateKeyOptions regenerateKeyParameters, CancellationToken cancellationToken = default) { - if (regenerateKeyOptions == null) + if (regenerateKeyParameters == null) { - throw new ArgumentNullException(nameof(regenerateKeyOptions)); + throw new ArgumentNullException(nameof(regenerateKeyParameters)); } using var scope = _clientDiagnostics.CreateScope("ConfigurationStore.RegenerateKey"); scope.Start(); try { - var response = await _configurationStoresRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyOptions, cancellationToken).ConfigureAwait(false); + var response = await _configurationStoresRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyParameters, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -547,71 +547,21 @@ public async virtual Task> RegenerateKeyAsync(RegenerateKeyOpti } /// Regenerates an access key for the specified configuration store. - /// The options for regenerating an access key. + /// The parameters for regenerating an access key. /// The cancellation token to use. - /// is null. - public virtual Response RegenerateKey(RegenerateKeyOptions regenerateKeyOptions, CancellationToken cancellationToken = default) + /// is null. + public virtual Response RegenerateKey(RegenerateKeyOptions regenerateKeyParameters, CancellationToken cancellationToken = default) { - if (regenerateKeyOptions == null) + if (regenerateKeyParameters == null) { - throw new ArgumentNullException(nameof(regenerateKeyOptions)); + throw new ArgumentNullException(nameof(regenerateKeyParameters)); } using var scope = _clientDiagnostics.CreateScope("ConfigurationStore.RegenerateKey"); scope.Start(); try { - var response = _configurationStoresRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyOptions, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists a configuration store key-value. - /// The options for retrieving a key-value. - /// The cancellation token to use. - /// is null. - public async virtual Task> GetKeyValueAsync(ListKeyValueOptions listKeyValueOptions, CancellationToken cancellationToken = default) - { - if (listKeyValueOptions == null) - { - throw new ArgumentNullException(nameof(listKeyValueOptions)); - } - - using var scope = _clientDiagnostics.CreateScope("ConfigurationStore.GetKeyValue"); - scope.Start(); - try - { - var response = await _configurationStoresRestClient.ListKeyValueAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, listKeyValueOptions, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists a configuration store key-value. - /// The options for retrieving a key-value. - /// The cancellation token to use. - /// is null. - public virtual Response GetKeyValue(ListKeyValueOptions listKeyValueOptions, CancellationToken cancellationToken = default) - { - if (listKeyValueOptions == null) - { - throw new ArgumentNullException(nameof(listKeyValueOptions)); - } - - using var scope = _clientDiagnostics.CreateScope("ConfigurationStore.GetKeyValue"); - scope.Start(); - try - { - var response = _configurationStoresRestClient.ListKeyValue(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, listKeyValueOptions, cancellationToken); + var response = _configurationStoresRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyParameters, cancellationToken); return response; } catch (Exception e) @@ -640,5 +590,15 @@ public virtual PrivateLinkResourceCollection GetPrivateLinkResources() return new PrivateLinkResourceCollection(this); } #endregion + + #region KeyValue + + /// Gets a collection of KeyValues in the ConfigurationStore. + /// An object representing collection of KeyValues and their operations over a ConfigurationStore. + public virtual KeyValueCollection GetKeyValues() + { + return new KeyValueCollection(this); + } + #endregion } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ConfigurationStoreData.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ConfigurationStoreData.cs index 777d4995676a..578f3b3f50ff 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ConfigurationStoreData.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ConfigurationStoreData.cs @@ -40,28 +40,34 @@ public ConfigurationStoreData(AzureLocation location, Models.Sku sku) : base(loc /// The location. /// The managed identity information, if configured. /// The sku of the configuration store. + /// Resource system metadata. /// The provisioning state of the configuration store. /// The creation date of configuration store. /// The DNS endpoint where the configuration store API will be available. /// The encryption settings of the configuration store. /// The list of private endpoint connections that are set up for this resource. /// Control permission for data plane traffic coming from public networks while private endpoint is enabled. - internal ConfigurationStoreData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, AzureLocation location, ResourceIdentity identity, Models.Sku sku, ProvisioningState? provisioningState, DateTimeOffset? creationDate, string endpoint, Models.EncryptionProperties encryption, IReadOnlyList privateEndpointConnections, PublicNetworkAccess? publicNetworkAccess) : base(id, name, type, tags, location) + /// Disables all authentication methods other than AAD authentication. + internal ConfigurationStoreData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, AzureLocation location, ResourceIdentity identity, Models.Sku sku, SystemData systemData, ProvisioningState? provisioningState, DateTimeOffset? creationDate, string endpoint, Models.EncryptionProperties encryption, IReadOnlyList privateEndpointConnections, PublicNetworkAccess? publicNetworkAccess, bool? disableLocalAuth) : base(id, name, type, tags, location) { Identity = identity; Sku = sku; + SystemData = systemData; ProvisioningState = provisioningState; CreationDate = creationDate; Endpoint = endpoint; Encryption = encryption; PrivateEndpointConnections = privateEndpointConnections; PublicNetworkAccess = publicNetworkAccess; + DisableLocalAuth = disableLocalAuth; } /// The managed identity information, if configured. public ResourceIdentity Identity { get; set; } /// The sku of the configuration store. public Models.Sku Sku { get; set; } + /// Resource system metadata. + public SystemData SystemData { get; } /// The provisioning state of the configuration store. public ProvisioningState? ProvisioningState { get; } /// The creation date of configuration store. @@ -74,5 +80,7 @@ internal ConfigurationStoreData(ResourceIdentifier id, string name, ResourceType public IReadOnlyList PrivateEndpointConnections { get; } /// Control permission for data plane traffic coming from public networks while private endpoint is enabled. public PublicNetworkAccess? PublicNetworkAccess { get; set; } + /// Disables all authentication methods other than AAD authentication. + public bool? DisableLocalAuth { get; set; } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/ArmClientExtensions.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/ArmClientExtensions.cs index 2463948c6d3a..def2e16444f0 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/ArmClientExtensions.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/ArmClientExtensions.cs @@ -48,5 +48,17 @@ public static PrivateLinkResource GetPrivateLinkResource(this ArmClient armClien return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new PrivateLinkResource(clientOptions, credential, uri, pipeline, id)); } #endregion + + #region KeyValue + /// Gets an object representing a KeyValue along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static KeyValue GetKeyValue(this ArmClient armClient, ResourceIdentifier id) + { + KeyValue.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new KeyValue(clientOptions, credential, uri, pipeline, id)); + } + #endregion } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValue.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValue.cs new file mode 100644 index 000000000000..27dbd0d67815 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValue.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppConfiguration.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppConfiguration +{ + /// A Class representing a KeyValue along with the instance operations that can be performed on it. + public partial class KeyValue : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly KeyValuesRestOperations _keyValuesRestClient; + private readonly KeyValueData _data; + + /// Initializes a new instance of the class for mocking. + protected KeyValue() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal KeyValue(ArmResource options, KeyValueData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + ClientOptions.TryGetApiVersion(ResourceType, out string apiVersion); + _keyValuesRestClient = new KeyValuesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri, apiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal KeyValue(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + ClientOptions.TryGetApiVersion(ResourceType, out string apiVersion); + _keyValuesRestClient = new KeyValuesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri, apiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal KeyValue(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + ClientOptions.TryGetApiVersion(ResourceType, out string apiVersion); + _keyValuesRestClient = new KeyValuesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri, apiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AppConfiguration/configurationStores/keyValues"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual KeyValueData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets the properties of the specified key-value. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("KeyValue.Get"); + scope.Start(); + try + { + var response = await _keyValuesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new KeyValue(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the properties of the specified key-value. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("KeyValue.Get"); + scope.Start(); + try + { + var response = _keyValuesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new KeyValue(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("KeyValue.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("KeyValue.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a key-value. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("KeyValue.Delete"); + scope.Start(); + try + { + var response = await _keyValuesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new KeyValueDeleteOperation(_clientDiagnostics, Pipeline, _keyValuesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a key-value. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual KeyValueDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("KeyValue.Delete"); + scope.Start(); + try + { + var response = _keyValuesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new KeyValueDeleteOperation(_clientDiagnostics, Pipeline, _keyValuesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValueCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValueCollection.cs new file mode 100644 index 000000000000..efc7721c22ac --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValueCollection.cs @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.AppConfiguration.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppConfiguration +{ + /// A class representing collection of KeyValue and their operations over its parent. + public partial class KeyValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly KeyValuesRestOperations _keyValuesRestClient; + + /// Initializes a new instance of the class for mocking. + protected KeyValueCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal KeyValueCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + ClientOptions.TryGetApiVersion(KeyValue.ResourceType, out string apiVersion); + _keyValuesRestClient = new KeyValuesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri, apiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ConfigurationStore.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ConfigurationStore.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Creates a key-value. + /// Waits for the completion of the long running operations. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The parameters for creating a key-value. + /// The cancellation token to use. + /// is empty. + /// is null. + public virtual KeyValueCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string keyValueName, KeyValueData keyValueParameters = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _keyValuesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyValueName, keyValueParameters, cancellationToken); + var operation = new KeyValueCreateOrUpdateOperation(this, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates a key-value. + /// Waits for the completion of the long running operations. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The parameters for creating a key-value. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string keyValueName, KeyValueData keyValueParameters = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _keyValuesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyValueName, keyValueParameters, cancellationToken).ConfigureAwait(false); + var operation = new KeyValueCreateOrUpdateOperation(this, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the properties of the specified key-value. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// is empty. + /// is null. + public virtual Response Get(string keyValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.Get"); + scope.Start(); + try + { + var response = _keyValuesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyValueName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new KeyValue(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the properties of the specified key-value. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual Task> GetAsync(string keyValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.Get"); + scope.Start(); + try + { + var response = await _keyValuesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyValueName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new KeyValue(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// is empty. + /// is null. + public virtual Response GetIfExists(string keyValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _keyValuesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyValueName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new KeyValue(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual Task> GetIfExistsAsync(string keyValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _keyValuesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyValueName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new KeyValue(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// is empty. + /// is null. + public virtual Response Exists(string keyValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(keyValueName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// is empty. + /// is null. + public async virtual Task> ExistsAsync(string keyValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(keyValueName, nameof(keyValueName)); + + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(keyValueName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists the key-values for a given configuration store. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string skipToken = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.GetAll"); + scope.Start(); + try + { + var response = _keyValuesRestClient.ListByConfigurationStore(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new KeyValue(this, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.GetAll"); + scope.Start(); + try + { + var response = _keyValuesRestClient.ListByConfigurationStoreNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new KeyValue(this, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Lists the key-values for a given configuration store. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string skipToken = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.GetAll"); + scope.Start(); + try + { + var response = await _keyValuesRestClient.ListByConfigurationStoreAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new KeyValue(this, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("KeyValueCollection.GetAll"); + scope.Start(); + try + { + var response = await _keyValuesRestClient.ListByConfigurationStoreNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new KeyValue(this, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValue.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValueData.cs similarity index 76% rename from sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValue.cs rename to sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValueData.cs index e8e7379278a6..d2842559cb65 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValue.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/KeyValueData.cs @@ -8,19 +8,23 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.AppConfiguration.Models +namespace Azure.ResourceManager.AppConfiguration { - /// The result of a request to retrieve a key-value from the specified configuration store. - public partial class KeyValue + /// A class representing the KeyValue data model. + public partial class KeyValueData : Resource { - /// Initializes a new instance of KeyValue. - internal KeyValue() + /// Initializes a new instance of KeyValueData. + public KeyValueData() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of KeyValue. + /// Initializes a new instance of KeyValueData. + /// The id. + /// The name. + /// The type. /// /// The primary identifier of a key-value. /// The key is used in unison with the label to uniquely identify a key-value. @@ -41,7 +45,7 @@ internal KeyValue() /// A locked key-value may not be modified until it is unlocked. /// /// A dictionary of tags that can help identify what a key-value may be applicable for. - internal KeyValue(string key, string label, string value, string contentType, string eTag, DateTimeOffset? lastModified, bool? locked, IReadOnlyDictionary tags) + internal KeyValueData(ResourceIdentifier id, string name, ResourceType type, string key, string label, string value, string contentType, string eTag, DateTimeOffset? lastModified, bool? locked, IDictionary tags) : base(id, name, type) { Key = key; Label = label; @@ -64,12 +68,12 @@ internal KeyValue(string key, string label, string value, string contentType, st /// public string Label { get; } /// The value of the key-value. - public string Value { get; } + public string Value { get; set; } /// /// The content type of the key-value's value. /// Providing a proper content-type can enable transformations of values when they are retrieved by applications. /// - public string ContentType { get; } + public string ContentType { get; set; } /// An ETag indicating the state of a key-value within a configuration store. public string ETag { get; } /// The last time a modifying operation was performed on the given key-value. @@ -80,6 +84,6 @@ internal KeyValue(string key, string label, string value, string contentType, st /// public bool? Locked { get; } /// A dictionary of tags that can help identify what a key-value may be applicable for. - public IReadOnlyDictionary Tags { get; } + public IDictionary Tags { get; } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/LongRunningOperation/KeyValueCreateOrUpdateOperation.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/LongRunningOperation/KeyValueCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..67841da23afe --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/LongRunningOperation/KeyValueCreateOrUpdateOperation.cs @@ -0,0 +1,60 @@ +// 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.ResourceManager.AppConfiguration; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppConfiguration.Models +{ + /// Creates a key-value. + public partial class KeyValueCreateOrUpdateOperation : Operation + { + private readonly OperationOrResponseInternals _operation; + + /// Initializes a new instance of KeyValueCreateOrUpdateOperation for mocking. + protected KeyValueCreateOrUpdateOperation() + { + } + + internal KeyValueCreateOrUpdateOperation(ArmResource operationsBase, Response response) + { + _operation = new OperationOrResponseInternals(Response.FromValue(new KeyValue(operationsBase, response.Value), response.GetRawResponse())); + } + + /// + public override string Id => _operation.Id; + + /// + public override KeyValue 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); + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/LongRunningOperation/KeyValueDeleteOperation.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/LongRunningOperation/KeyValueDeleteOperation.cs new file mode 100644 index 000000000000..91344cbc6ced --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/LongRunningOperation/KeyValueDeleteOperation.cs @@ -0,0 +1,53 @@ +// 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.AppConfiguration.Models +{ + /// Deletes a key-value. + public partial class KeyValueDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of KeyValueDeleteOperation for mocking. + protected KeyValueDeleteOperation() + { + } + + internal KeyValueDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "KeyValueDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + 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 WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreData.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreData.Serialization.cs index eb8407961193..1614f3d03f83 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreData.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreData.Serialization.cs @@ -10,6 +10,7 @@ using System.Text.Json; using Azure.Core; using Azure.ResourceManager.AppConfiguration.Models; +using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.AppConfiguration @@ -48,6 +49,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNetworkAccess"); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (Optional.IsDefined(DisableLocalAuth)) + { + writer.WritePropertyName("disableLocalAuth"); + writer.WriteBooleanValue(DisableLocalAuth.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -56,6 +62,7 @@ internal static ConfigurationStoreData DeserializeConfigurationStoreData(JsonEle { Optional identity = default; Models.Sku sku = default; + Optional systemData = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -64,9 +71,10 @@ internal static ConfigurationStoreData DeserializeConfigurationStoreData(JsonEle Optional provisioningState = default; Optional creationDate = default; Optional endpoint = default; - Optional encryption = default; + Optional encryption = default; Optional> privateEndpointConnections = default; Optional publicNetworkAccess = default; + Optional disableLocalAuth = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity")) @@ -84,6 +92,16 @@ internal static ConfigurationStoreData DeserializeConfigurationStoreData(JsonEle sku = Models.Sku.DeserializeSku(property.Value); continue; } + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.ToString()); + continue; + } if (property.NameEquals("tags")) { Dictionary dictionary = new Dictionary(); @@ -155,7 +173,7 @@ internal static ConfigurationStoreData DeserializeConfigurationStoreData(JsonEle property0.ThrowNonNullablePropertyIsNull(); continue; } - encryption = EncryptionProperties.DeserializeEncryptionProperties(property0.Value); + encryption = Models.EncryptionProperties.DeserializeEncryptionProperties(property0.Value); continue; } if (property0.NameEquals("privateEndpointConnections")) @@ -183,11 +201,21 @@ internal static ConfigurationStoreData DeserializeConfigurationStoreData(JsonEle publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } + if (property0.NameEquals("disableLocalAuth")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + disableLocalAuth = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new ConfigurationStoreData(id, name, type, tags, location, identity, sku, Optional.ToNullable(provisioningState), Optional.ToNullable(creationDate), endpoint.Value, encryption.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess)); + return new ConfigurationStoreData(id, name, type, tags, location, identity, sku, systemData, Optional.ToNullable(provisioningState), Optional.ToNullable(creationDate), endpoint.Value, encryption.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(disableLocalAuth)); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreUpdateOptions.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreUpdateOptions.Serialization.cs index 4ea995bde5fd..e868a63bb35e 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreUpdateOptions.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreUpdateOptions.Serialization.cs @@ -43,6 +43,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("encryption"); writer.WriteObjectValue(Encryption); } + if (Optional.IsDefined(DisableLocalAuth)) + { + writer.WritePropertyName("disableLocalAuth"); + writer.WriteBooleanValue(DisableLocalAuth.Value); + } if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreUpdateOptions.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreUpdateOptions.cs index 07d3073627c3..d1a55dfe3e13 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreUpdateOptions.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ConfigurationStoreUpdateOptions.cs @@ -28,6 +28,8 @@ public ConfigurationStoreUpdateOptions() public IDictionary Tags { get; } /// The encryption settings of the configuration store. public EncryptionProperties Encryption { get; set; } + /// Disables all authentication methods other than AAD authentication. + public bool? DisableLocalAuth { get; set; } /// Control permission for data plane traffic coming from public networks while private endpoint is enabled. public PublicNetworkAccess? PublicNetworkAccess { get; set; } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/CreatedByType.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..b93b8e14f0df --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/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.AppConfiguration.Models +{ + /// The type of identity that created the resource. + public readonly partial struct CreatedByType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// 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/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/Error.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/Error.Serialization.cs deleted file mode 100644 index e5eb04140449..000000000000 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/Error.Serialization.cs +++ /dev/null @@ -1,35 +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.AppConfiguration.Models -{ - internal partial class Error - { - internal static Error DeserializeError(JsonElement element) - { - Optional code = default; - Optional message = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code")) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message")) - { - message = property.Value.GetString(); - continue; - } - } - return new Error(code.Value, message.Value); - } - } -} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/Error.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/Error.cs deleted file mode 100644 index 6bc7bf081d0d..000000000000 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/Error.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.AppConfiguration.Models -{ - /// AppConfiguration error object. - internal partial class Error - { - /// Initializes a new instance of Error. - internal Error() - { - } - - /// Initializes a new instance of Error. - /// Error code. - /// Error message. - internal Error(string code, string message) - { - Code = code; - Message = message; - } - - /// Error code. - public string Code { get; } - /// Error message. - public string Message { get; } - } -} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorDetails.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorDetails.Serialization.cs new file mode 100644 index 000000000000..4eef08a64f22 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorDetails.Serialization.cs @@ -0,0 +1,53 @@ +// 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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppConfiguration.Models +{ + internal partial class ErrorDetails + { + internal static ErrorDetails DeserializeErrorDetails(JsonElement element) + { + Optional code = default; + Optional message = default; + Optional> additionalInfo = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code")) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message")) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("additionalInfo")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.ToString())); + } + additionalInfo = array; + continue; + } + } + return new ErrorDetails(code.Value, message.Value, Optional.ToList(additionalInfo)); + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorDetails.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorDetails.cs new file mode 100644 index 000000000000..7126a42633d8 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorDetails.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppConfiguration.Models +{ + /// The details of the error. + internal partial class ErrorDetails + { + /// Initializes a new instance of ErrorDetails. + internal ErrorDetails() + { + AdditionalInfo = new ChangeTrackingList(); + } + + /// Initializes a new instance of ErrorDetails. + /// Error code. + /// Error message indicating why the operation failed. + /// The error additional info. + internal ErrorDetails(string code, string message, IReadOnlyList additionalInfo) + { + Code = code; + Message = message; + AdditionalInfo = additionalInfo; + } + + /// Error code. + public string Code { get; } + /// Error message indicating why the operation failed. + public string Message { get; } + /// The error additional info. + public IReadOnlyList AdditionalInfo { get; } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorResponse.Serialization.cs new file mode 100644 index 000000000000..39cab62a62d7 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorResponse.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.AppConfiguration.Models +{ + internal partial class ErrorResponse + { + internal static ErrorResponse DeserializeErrorResponse(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 = ErrorDetails.DeserializeErrorDetails(property.Value); + continue; + } + } + return new ErrorResponse(error.Value); + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorResponse.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..83705a7085e4 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AppConfiguration.Models +{ + /// Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + internal partial class ErrorResponse + { + /// Initializes a new instance of ErrorResponse. + internal ErrorResponse() + { + } + + /// Initializes a new instance of ErrorResponse. + /// The details of the error. + internal ErrorResponse(ErrorDetails error) + { + Error = error; + } + + /// The details of the error. + public ErrorDetails Error { get; } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValue.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValue.Serialization.cs deleted file mode 100644 index 98c862f8fc1a..000000000000 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValue.Serialization.cs +++ /dev/null @@ -1,93 +0,0 @@ -// 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.AppConfiguration.Models -{ - public partial class KeyValue - { - internal static KeyValue DeserializeKeyValue(JsonElement element) - { - Optional key = default; - Optional label = default; - Optional value = default; - Optional contentType = default; - Optional eTag = default; - Optional lastModified = default; - Optional locked = default; - Optional> tags = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("key")) - { - key = property.Value.GetString(); - continue; - } - if (property.NameEquals("label")) - { - label = property.Value.GetString(); - continue; - } - if (property.NameEquals("value")) - { - value = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentType")) - { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("eTag")) - { - eTag = property.Value.GetString(); - continue; - } - if (property.NameEquals("lastModified")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - lastModified = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("locked")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - locked = property.Value.GetBoolean(); - 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; - } - } - return new KeyValue(key.Value, label.Value, value.Value, contentType.Value, eTag.Value, Optional.ToNullable(lastModified), Optional.ToNullable(locked), Optional.ToDictionary(tags)); - } - } -} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueData.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueData.Serialization.cs new file mode 100644 index 000000000000..26953883527d --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueData.Serialization.cs @@ -0,0 +1,153 @@ +// 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.AppConfiguration +{ + public partial class KeyValueData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(ContentType)) + { + writer.WritePropertyName("contentType"); + writer.WriteStringValue(ContentType); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static KeyValueData DeserializeKeyValueData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional key = default; + Optional label = default; + Optional value = default; + Optional contentType = default; + Optional eTag = default; + Optional lastModified = default; + Optional locked = default; + Optional> tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(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("key")) + { + key = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("label")) + { + label = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("value")) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("contentType")) + { + contentType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("eTag")) + { + eTag = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastModified")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + lastModified = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("locked")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + locked = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("tags")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + tags = dictionary; + continue; + } + } + continue; + } + } + return new KeyValueData(id, name, type, key.Value, label.Value, value.Value, contentType.Value, eTag.Value, Optional.ToNullable(lastModified), Optional.ToNullable(locked), Optional.ToDictionary(tags)); + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueListResult.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueListResult.Serialization.cs new file mode 100644 index 000000000000..2c27804bb5f5 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueListResult.Serialization.cs @@ -0,0 +1,47 @@ +// 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; +using Azure.ResourceManager.AppConfiguration; + +namespace Azure.ResourceManager.AppConfiguration.Models +{ + internal partial class KeyValueListResult + { + internal static KeyValueListResult DeserializeKeyValueListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = 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(KeyValueData.DeserializeKeyValueData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new KeyValueListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueListResult.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueListResult.cs new file mode 100644 index 000000000000..0ac2a4c36d09 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/KeyValueListResult.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; +using Azure.ResourceManager.AppConfiguration; + +namespace Azure.ResourceManager.AppConfiguration.Models +{ + /// The result of a request to list key-values. + internal partial class KeyValueListResult + { + /// Initializes a new instance of KeyValueListResult. + internal KeyValueListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of KeyValueListResult. + /// The collection value. + /// The URI that can be used to request the next set of paged results. + internal KeyValueListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The collection value. + public IReadOnlyList Value { get; } + /// The URI that can be used to request the next set of paged results. + public string NextLink { get; } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ListKeyValueOptions.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ListKeyValueOptions.Serialization.cs deleted file mode 100644 index 17ad5d8a47cd..000000000000 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ListKeyValueOptions.Serialization.cs +++ /dev/null @@ -1,28 +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.AppConfiguration.Models -{ - public partial class ListKeyValueOptions : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"); - writer.WriteStringValue(Key); - if (Optional.IsDefined(Label)) - { - writer.WritePropertyName("label"); - writer.WriteStringValue(Label); - } - writer.WriteEndObject(); - } - } -} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ListKeyValueOptions.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ListKeyValueOptions.cs deleted file mode 100644 index b2fd561c7f11..000000000000 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/ListKeyValueOptions.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.AppConfiguration.Models -{ - /// The parameters used to list a configuration store key-value. - public partial class ListKeyValueOptions - { - /// Initializes a new instance of ListKeyValueOptions. - /// The key to retrieve. - /// is null. - public ListKeyValueOptions(string key) - { - if (key == null) - { - throw new ArgumentNullException(nameof(key)); - } - - Key = key; - } - - /// The key to retrieve. - public string Key { get; } - /// The label of the key. - public string Label { get; set; } - } -} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/AppConfigurationManagementRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/AppConfigurationManagementRestOperations.cs index 7a41f9cfb384..7d3fbcf86de3 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/AppConfigurationManagementRestOperations.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/AppConfigurationManagementRestOperations.cs @@ -36,7 +36,7 @@ internal partial class AppConfigurationManagementRestOperations public AppConfigurationManagementRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ArmClientOptions options, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2020-06-01"; + this.apiVersion = apiVersion ?? "2021-03-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/ConfigurationStoresRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/ConfigurationStoresRestOperations.cs index aa9b227fcaef..43fa94494037 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/ConfigurationStoresRestOperations.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/ConfigurationStoresRestOperations.cs @@ -36,7 +36,7 @@ internal partial class ConfigurationStoresRestOperations public ConfigurationStoresRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ArmClientOptions options, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2020-06-01"; + this.apiVersion = apiVersion ?? "2021-03-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); @@ -607,7 +607,7 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); uri.AppendPath(configStoreName, true); - uri.AppendPath("/ListKeys", false); + uri.AppendPath("/listKeys", false); uri.AppendQuery("api-version", apiVersion, true); if (skipToken != null) { @@ -695,7 +695,7 @@ public Response ListKeys(string subscriptionId, string resourc } } - internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string resourceGroupName, string configStoreName, RegenerateKeyOptions regenerateKeyOptions) + internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string resourceGroupName, string configStoreName, RegenerateKeyOptions regenerateKeyParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -708,13 +708,13 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); uri.AppendPath(configStoreName, true); - uri.AppendPath("/RegenerateKey", false); + uri.AppendPath("/regenerateKey", 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(regenerateKeyOptions); + content.JsonWriter.WriteObjectValue(regenerateKeyParameters); request.Content = content; message.SetProperty("UserAgentOverride", _userAgent); return message; @@ -724,10 +724,10 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re /// The Microsoft Azure subscription ID. /// The name of the resource group to which the container registry belongs. /// The name of the configuration store. - /// The options for regenerating an access key. + /// The parameters for regenerating an access key. /// The cancellation token to use. - /// , , , or is null. - public async Task> RegenerateKeyAsync(string subscriptionId, string resourceGroupName, string configStoreName, RegenerateKeyOptions regenerateKeyOptions, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> RegenerateKeyAsync(string subscriptionId, string resourceGroupName, string configStoreName, RegenerateKeyOptions regenerateKeyParameters, CancellationToken cancellationToken = default) { if (subscriptionId == null) { @@ -741,12 +741,12 @@ public async Task> RegenerateKeyAsync(string subscriptionId, st { throw new ArgumentNullException(nameof(configStoreName)); } - if (regenerateKeyOptions == null) + if (regenerateKeyParameters == null) { - throw new ArgumentNullException(nameof(regenerateKeyOptions)); + throw new ArgumentNullException(nameof(regenerateKeyParameters)); } - using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, configStoreName, regenerateKeyOptions); + using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, configStoreName, regenerateKeyParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -766,10 +766,10 @@ public async Task> RegenerateKeyAsync(string subscriptionId, st /// The Microsoft Azure subscription ID. /// The name of the resource group to which the container registry belongs. /// The name of the configuration store. - /// The options for regenerating an access key. + /// The parameters for regenerating an access key. /// The cancellation token to use. - /// , , , or is null. - public Response RegenerateKey(string subscriptionId, string resourceGroupName, string configStoreName, RegenerateKeyOptions regenerateKeyOptions, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response RegenerateKey(string subscriptionId, string resourceGroupName, string configStoreName, RegenerateKeyOptions regenerateKeyParameters, CancellationToken cancellationToken = default) { if (subscriptionId == null) { @@ -783,12 +783,12 @@ public Response RegenerateKey(string subscriptionId, string resourceGrou { throw new ArgumentNullException(nameof(configStoreName)); } - if (regenerateKeyOptions == null) + if (regenerateKeyParameters == null) { - throw new ArgumentNullException(nameof(regenerateKeyOptions)); + throw new ArgumentNullException(nameof(regenerateKeyParameters)); } - using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, configStoreName, regenerateKeyOptions); + using var message = CreateRegenerateKeyRequest(subscriptionId, resourceGroupName, configStoreName, regenerateKeyParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -804,115 +804,6 @@ public Response RegenerateKey(string subscriptionId, string resourceGrou } } - internal HttpMessage CreateListKeyValueRequest(string subscriptionId, string resourceGroupName, string configStoreName, ListKeyValueOptions listKeyValueOptions) - { - 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.AppConfiguration/configurationStores/", false); - uri.AppendPath(configStoreName, true); - uri.AppendPath("/listKeyValue", 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(listKeyValueOptions); - request.Content = content; - message.SetProperty("UserAgentOverride", _userAgent); - return message; - } - - /// Lists a configuration store key-value. - /// The Microsoft Azure subscription ID. - /// The name of the resource group to which the container registry belongs. - /// The name of the configuration store. - /// The options for retrieving a key-value. - /// The cancellation token to use. - /// , , , or is null. - public async Task> ListKeyValueAsync(string subscriptionId, string resourceGroupName, string configStoreName, ListKeyValueOptions listKeyValueOptions, CancellationToken cancellationToken = default) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (configStoreName == null) - { - throw new ArgumentNullException(nameof(configStoreName)); - } - if (listKeyValueOptions == null) - { - throw new ArgumentNullException(nameof(listKeyValueOptions)); - } - - using var message = CreateListKeyValueRequest(subscriptionId, resourceGroupName, configStoreName, listKeyValueOptions); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyValue value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = KeyValue.DeserializeKeyValue(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Lists a configuration store key-value. - /// The Microsoft Azure subscription ID. - /// The name of the resource group to which the container registry belongs. - /// The name of the configuration store. - /// The options for retrieving a key-value. - /// The cancellation token to use. - /// , , , or is null. - public Response ListKeyValue(string subscriptionId, string resourceGroupName, string configStoreName, ListKeyValueOptions listKeyValueOptions, CancellationToken cancellationToken = default) - { - if (subscriptionId == null) - { - throw new ArgumentNullException(nameof(subscriptionId)); - } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (configStoreName == null) - { - throw new ArgumentNullException(nameof(configStoreName)); - } - if (listKeyValueOptions == null) - { - throw new ArgumentNullException(nameof(listKeyValueOptions)); - } - - using var message = CreateListKeyValueRequest(subscriptionId, resourceGroupName, configStoreName, listKeyValueOptions); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyValue value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = KeyValue.DeserializeKeyValue(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string skipToken) { var message = _pipeline.CreateMessage(); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/KeyValuesRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/KeyValuesRestOperations.cs new file mode 100644 index 000000000000..323eeb2785bc --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/KeyValuesRestOperations.cs @@ -0,0 +1,571 @@ +// 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; +using Azure.ResourceManager.AppConfiguration.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppConfiguration +{ + internal partial class KeyValuesRestOperations + { + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of KeyValuesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// server parameter. + /// Api Version. + /// is null. + public KeyValuesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ArmClientOptions options, Uri endpoint = null, string apiVersion = default) + { + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? "2021-03-01-preview"; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateListByConfigurationStoreRequest(string subscriptionId, string resourceGroupName, string configStoreName, string skipToken) + { + 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.AppConfiguration/configurationStores/", false); + uri.AppendPath(configStoreName, true); + uri.AppendPath("/keyValues", false); + uri.AppendQuery("api-version", apiVersion, true); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Lists the key-values for a given configuration store. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByConfigurationStoreAsync(string subscriptionId, string resourceGroupName, string configStoreName, string skipToken = null, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + + using var message = CreateListByConfigurationStoreRequest(subscriptionId, resourceGroupName, configStoreName, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + KeyValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = KeyValueListResult.DeserializeKeyValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the key-values for a given configuration store. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// , , or is null. + public Response ListByConfigurationStore(string subscriptionId, string resourceGroupName, string configStoreName, string skipToken = null, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + + using var message = CreateListByConfigurationStoreRequest(subscriptionId, resourceGroupName, configStoreName, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + KeyValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = KeyValueListResult.DeserializeKeyValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName) + { + 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.AppConfiguration/configurationStores/", false); + uri.AppendPath(configStoreName, true); + uri.AppendPath("/keyValues/", false); + uri.AppendPath(keyValueName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Gets the properties of the specified key-value. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + if (keyValueName == null) + { + throw new ArgumentNullException(nameof(keyValueName)); + } + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, configStoreName, keyValueName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + KeyValueData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = KeyValueData.DeserializeKeyValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((KeyValueData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the properties of the specified key-value. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + if (keyValueName == null) + { + throw new ArgumentNullException(nameof(keyValueName)); + } + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, configStoreName, keyValueName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + KeyValueData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = KeyValueData.DeserializeKeyValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((KeyValueData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName, KeyValueData keyValueParameters) + { + 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.AppConfiguration/configurationStores/", false); + uri.AppendPath(configStoreName, true); + uri.AppendPath("/keyValues/", false); + uri.AppendPath(keyValueName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (keyValueParameters != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(keyValueParameters); + request.Content = content; + } + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Creates a key-value. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The parameters for creating a key-value. + /// The cancellation token to use. + /// , , , or is null. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName, KeyValueData keyValueParameters = null, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + if (keyValueName == null) + { + throw new ArgumentNullException(nameof(keyValueName)); + } + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, configStoreName, keyValueName, keyValueParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + KeyValueData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = KeyValueData.DeserializeKeyValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a key-value. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The parameters for creating a key-value. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName, KeyValueData keyValueParameters = null, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + if (keyValueName == null) + { + throw new ArgumentNullException(nameof(keyValueName)); + } + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, configStoreName, keyValueName, keyValueParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + KeyValueData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = KeyValueData.DeserializeKeyValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName) + { + 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.AppConfiguration/configurationStores/", false); + uri.AppendPath(configStoreName, true); + uri.AppendPath("/keyValues/", false); + uri.AppendPath(keyValueName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Deletes a key-value. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + if (keyValueName == null) + { + throw new ArgumentNullException(nameof(keyValueName)); + } + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, configStoreName, keyValueName); + 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 a key-value. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. + /// The cancellation token to use. + /// , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName, CancellationToken cancellationToken = default) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + if (keyValueName == null) + { + throw new ArgumentNullException(nameof(keyValueName)); + } + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, configStoreName, keyValueName); + _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 CreateListByConfigurationStoreNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string configStoreName, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Lists the key-values for a given configuration store. + /// The URL to the next page of results. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByConfigurationStoreNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string configStoreName, string skipToken = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + + using var message = CreateListByConfigurationStoreNextPageRequest(nextLink, subscriptionId, resourceGroupName, configStoreName, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + KeyValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = KeyValueListResult.DeserializeKeyValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the key-values for a given configuration store. + /// The URL to the next page of results. + /// The Microsoft Azure subscription ID. + /// The name of the resource group to which the container registry belongs. + /// The name of the configuration store. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByConfigurationStoreNextPage(string nextLink, string subscriptionId, string resourceGroupName, string configStoreName, string skipToken = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (configStoreName == null) + { + throw new ArgumentNullException(nameof(configStoreName)); + } + + using var message = CreateListByConfigurationStoreNextPageRequest(nextLink, subscriptionId, resourceGroupName, configStoreName, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + KeyValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = KeyValueListResult.DeserializeKeyValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 0971354a174e..156fd230325a 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -36,7 +36,7 @@ internal partial class PrivateEndpointConnectionsRestOperations public PrivateEndpointConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ArmClientOptions options, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2020-06-01"; + this.apiVersion = apiVersion ?? "2021-03-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index 23b9beae8b50..55119cbfc4c0 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -36,7 +36,7 @@ internal partial class PrivateLinkResourcesRestOperations public PrivateLinkResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ArmClientOptions options, Uri endpoint = null, string apiVersion = default) { this.endpoint = endpoint ?? new Uri("https://management.azure.com"); - this.apiVersion = apiVersion ?? "2020-06-01"; + this.apiVersion = apiVersion ?? "2021-03-01-preview"; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/autorest.md b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/autorest.md index 9318b48d1efb..ea7681898f10 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/autorest.md +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. azure-arm: true library-name: AppConfiguration namespace: Azure.ResourceManager.AppConfiguration -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/d302c82f32daec0feb68cd7d68d45ba898b67ee7/specification/appconfiguration/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/c7484084df2355bf25846558eb15eea585a8be95/specification/appconfiguration/resource-manager/readme.md clear-output-folder: true skip-csproj: true modelerfour: