diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/CHANGELOG.md index cbbe456b14f54..b838b124c1c62 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/CHANGELOG.md @@ -1,7 +1,92 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.2 (2021-05-14) +- Azure Resource Manager AppConfiguration client library for Java. This package contains Microsoft Azure SDK for AppConfiguration Management SDK. Package tag package-2021-03-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Breaking Change + +* `models.ListKeyValueParameters` was removed + +#### `models.ConfigurationStore$Update` was modified + +* `withPublicNetworkAccess(models.PublicNetworkAccess)` was removed + +#### `models.ConfigurationStoreUpdateParameters` was modified + +* `publicNetworkAccess()` was removed +* `withPublicNetworkAccess(models.PublicNetworkAccess)` was removed + +#### `models.ConfigurationStore` was modified + +* `listKeyValue(models.ListKeyValueParameters)` was removed +* `listKeyValueWithResponse(models.ListKeyValueParameters,com.azure.core.util.Context)` was removed + +#### `models.ConfigurationStores` was modified + +* `listKeyValue(java.lang.String,java.lang.String,models.ListKeyValueParameters)` was removed +* `listKeyValueWithResponse(java.lang.String,java.lang.String,models.ListKeyValueParameters,com.azure.core.util.Context)` was removed + +### New Feature + +* `models.KeyValue$Definition` was added + +* `models.KeyValue$UpdateStages` was added + +* `models.ServiceSpecification` was added + +* `models.OperationProperties` was added + +* `models.KeyValues` was added + +* `models.LogSpecification` was added + +* `models.MetricDimension` was added + +* `models.KeyValueListResult` was added + +* `models.KeyValue$Update` was added + +* `models.KeyValue$DefinitionStages` was added + +* `models.MetricSpecification` was added + +#### `models.ConfigurationStore$Update` was modified + +* `withDisableLocalAuth(java.lang.Boolean)` was added + +#### `models.ConfigurationStoreUpdateParameters` was modified + +* `withDisableLocalAuth(java.lang.Boolean)` was added +* `disableLocalAuth()` was added + +#### `models.OperationDefinition` was modified + +* `properties()` was added +* `isDataAction()` was added +* `origin()` was added + +#### `models.ConfigurationStore` was modified + +* `systemData()` was added +* `disableLocalAuth()` was added + +#### `AppConfigurationManager` was modified + +* `keyValues()` was added + +#### `models.ConfigurationStore$Definition` was modified + +* `withDisableLocalAuth(java.lang.Boolean)` was added + +#### `models.KeyValue` was modified + +* `refresh(com.azure.core.util.Context)` was added +* `type()` was added +* `refresh()` was added +* `name()` was added +* `id()` was added +* `update()` was added ## 1.0.0-beta.1 (2021-04-12) diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/README.md b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/README.md index eb0c8431b386d..a7e2414688a00 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/README.md @@ -2,7 +2,7 @@ Azure Resource Manager AppConfiguration client library for Java. -This package contains Microsoft Azure SDK for AppConfiguration Management SDK. Package tag package-2020-06-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for AppConfiguration Management SDK. Package tag package-2021-03-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-appconfiguration - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/pom.xml b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/pom.xml index 84d83d3f9100f..5153383b7cf1a 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for AppConfiguration Management - This package contains Microsoft Azure SDK for AppConfiguration Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2020-06-01. + This package contains Microsoft Azure SDK for AppConfiguration Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-03-01-preview. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/AppConfigurationManager.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/AppConfigurationManager.java index 15e3a318d3b48..2442cc8eae7f0 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/AppConfigurationManager.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/AppConfigurationManager.java @@ -23,10 +23,12 @@ import com.azure.resourcemanager.appconfiguration.fluent.AppConfigurationManagementClient; import com.azure.resourcemanager.appconfiguration.implementation.AppConfigurationManagementClientBuilder; import com.azure.resourcemanager.appconfiguration.implementation.ConfigurationStoresImpl; +import com.azure.resourcemanager.appconfiguration.implementation.KeyValuesImpl; import com.azure.resourcemanager.appconfiguration.implementation.OperationsImpl; import com.azure.resourcemanager.appconfiguration.implementation.PrivateEndpointConnectionsImpl; import com.azure.resourcemanager.appconfiguration.implementation.PrivateLinkResourcesImpl; import com.azure.resourcemanager.appconfiguration.models.ConfigurationStores; +import com.azure.resourcemanager.appconfiguration.models.KeyValues; import com.azure.resourcemanager.appconfiguration.models.Operations; import com.azure.resourcemanager.appconfiguration.models.PrivateEndpointConnections; import com.azure.resourcemanager.appconfiguration.models.PrivateLinkResources; @@ -46,6 +48,8 @@ public final class AppConfigurationManager { private PrivateLinkResources privateLinkResources; + private KeyValues keyValues; + private final AppConfigurationManagementClient clientObject; private AppConfigurationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -170,7 +174,7 @@ public AppConfigurationManager authenticate(TokenCredential credential, AzurePro .append("-") .append("com.azure.resourcemanager.appconfiguration") .append("/") - .append("1.0.0-beta.1"); + .append("1.0.0-beta.2"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -242,6 +246,14 @@ public PrivateLinkResources privateLinkResources() { return privateLinkResources; } + /** @return Resource collection API of KeyValues. */ + public KeyValues keyValues() { + if (this.keyValues == null) { + this.keyValues = new KeyValuesImpl(clientObject.getKeyValues(), this); + } + return keyValues; + } + /** * @return Wrapped service client AppConfigurationManagementClient providing direct access to the underlying * auto-generated API implementation, based on Azure REST API. diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/AppConfigurationManagementClient.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/AppConfigurationManagementClient.java index 9ce6c721b7faa..1de2eb00efc9d 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/AppConfigurationManagementClient.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/AppConfigurationManagementClient.java @@ -71,4 +71,11 @@ public interface AppConfigurationManagementClient { * @return the PrivateLinkResourcesClient object. */ PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the KeyValuesClient object to access its operations. + * + * @return the KeyValuesClient object. + */ + KeyValuesClient getKeyValues(); } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/ConfigurationStoresClient.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/ConfigurationStoresClient.java index 98161a7e4e0b0..149b307e52112 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/ConfigurationStoresClient.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/ConfigurationStoresClient.java @@ -13,9 +13,7 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.appconfiguration.fluent.models.ApiKeyInner; import com.azure.resourcemanager.appconfiguration.fluent.models.ConfigurationStoreInner; -import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; import com.azure.resourcemanager.appconfiguration.models.ConfigurationStoreUpdateParameters; -import com.azure.resourcemanager.appconfiguration.models.ListKeyValueParameters; import com.azure.resourcemanager.appconfiguration.models.RegenerateKeyParameters; /** An instance of this class provides access to all the operations defined in ConfigurationStoresClient. */ @@ -358,38 +356,4 @@ Response regenerateKeyWithResponse( String configStoreName, RegenerateKeyParameters regenerateKeyParameters, Context context); - - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - KeyValueInner listKeyValue( - String resourceGroupName, String configStoreName, ListKeyValueParameters listKeyValueParameters); - - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response listKeyValueWithResponse( - String resourceGroupName, - String configStoreName, - ListKeyValueParameters listKeyValueParameters, - Context context); } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/KeyValuesClient.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/KeyValuesClient.java new file mode 100644 index 0000000000000..7146148f90f1d --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/KeyValuesClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; + +/** An instance of this class provides access to all the operations defined in KeyValuesClient. */ +public interface KeyValuesClient { + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByConfigurationStore(String resourceGroupName, String configStoreName); + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param skipToken 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByConfigurationStore( + String resourceGroupName, String configStoreName, String skipToken, Context context); + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + KeyValueInner get(String resourceGroupName, String configStoreName, String keyValueName); + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String configStoreName, String keyValueName, Context context); + + /** + * Creates a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the key-value resource along with all resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + KeyValueInner createOrUpdate(String resourceGroupName, String configStoreName, String keyValueName); + + /** + * Creates a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param keyValueParameters The parameters for creating a key-value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the key-value resource along with all resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String configStoreName, + String keyValueName, + KeyValueInner keyValueParameters, + Context context); + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String configStoreName, String keyValueName); + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String configStoreName, String keyValueName, Context context); + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String configStoreName, String keyValueName); + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String configStoreName, String keyValueName, Context context); +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/ConfigurationStoreInner.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/ConfigurationStoreInner.java index 0e0752aa6587a..5076c0d0d4d19 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/ConfigurationStoreInner.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/ConfigurationStoreInner.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.appconfiguration.models.EncryptionProperties; import com.azure.resourcemanager.appconfiguration.models.PrivateEndpointConnectionReference; @@ -41,6 +42,12 @@ public class ConfigurationStoreInner extends Resource { @JsonProperty(value = "sku", required = true) private Sku sku; + /* + * Resource system metadata. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + /* * The provisioning state of the configuration store. */ @@ -79,6 +86,12 @@ public class ConfigurationStoreInner extends Resource { @JsonProperty(value = "properties.publicNetworkAccess") private PublicNetworkAccess publicNetworkAccess; + /* + * Disables all authentication methods other than AAD authentication. + */ + @JsonProperty(value = "properties.disableLocalAuth") + private Boolean disableLocalAuth; + /** * Get the identity property: The managed identity information, if configured. * @@ -119,6 +132,15 @@ public ConfigurationStoreInner withSku(Sku sku) { return this; } + /** + * Get the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the provisioningState property: The provisioning state of the configuration store. * @@ -198,6 +220,26 @@ public ConfigurationStoreInner withPublicNetworkAccess(PublicNetworkAccess publi return this; } + /** + * Get the disableLocalAuth property: Disables all authentication methods other than AAD authentication. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.disableLocalAuth; + } + + /** + * Set the disableLocalAuth property: Disables all authentication methods other than AAD authentication. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the ConfigurationStoreInner object itself. + */ + public ConfigurationStoreInner withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + /** {@inheritDoc} */ @Override public ConfigurationStoreInner withLocation(String location) { diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/KeyValueInner.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/KeyValueInner.java index 816aa36dc62ac..8327cc3b94893 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/KeyValueInner.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/KeyValueInner.java @@ -4,16 +4,19 @@ package com.azure.resourcemanager.appconfiguration.fluent.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.Map; -/** The result of a request to retrieve a key-value from the specified configuration store. */ -@Immutable -public final class KeyValueInner { +/** The key-value resource along with all resource properties. */ +@JsonFlatten +@Fluent +public class KeyValueInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyValueInner.class); /* @@ -21,7 +24,7 @@ public final class KeyValueInner { * The key is used in unison with the label to uniquely identify a * key-value. */ - @JsonProperty(value = "key", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.key", access = JsonProperty.Access.WRITE_ONLY) private String key; /* @@ -29,13 +32,13 @@ public final class KeyValueInner { * The label is used in unison with the key to uniquely identify a * key-value. */ - @JsonProperty(value = "label", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.label", access = JsonProperty.Access.WRITE_ONLY) private String label; /* * The value of the key-value. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.value") private String value; /* @@ -43,35 +46,35 @@ public final class KeyValueInner { * Providing a proper content-type can enable transformations of values * when they are retrieved by applications. */ - @JsonProperty(value = "contentType", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.contentType") private String contentType; /* * An ETag indicating the state of a key-value within a configuration * store. */ - @JsonProperty(value = "eTag", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.eTag", access = JsonProperty.Access.WRITE_ONLY) private String etag; /* * The last time a modifying operation was performed on the given * key-value. */ - @JsonProperty(value = "lastModified", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.lastModified", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastModified; /* * A value indicating whether the key-value is locked. * A locked key-value may not be modified until it is unlocked. */ - @JsonProperty(value = "locked", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.locked", access = JsonProperty.Access.WRITE_ONLY) private Boolean locked; /* * A dictionary of tags that can help identify what a key-value may be * applicable for. */ - @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.tags") private Map tags; /** @@ -103,6 +106,17 @@ public String value() { return this.value; } + /** + * Set the value property: The value of the key-value. + * + * @param value the value value to set. + * @return the KeyValueInner object itself. + */ + public KeyValueInner withValue(String value) { + this.value = value; + return this; + } + /** * Get the contentType property: 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. @@ -113,6 +127,18 @@ public String contentType() { return this.contentType; } + /** + * Set the contentType property: 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. + * + * @param contentType the contentType value to set. + * @return the KeyValueInner object itself. + */ + public KeyValueInner withContentType(String contentType) { + this.contentType = contentType; + return this; + } + /** * Get the etag property: An ETag indicating the state of a key-value within a configuration store. * @@ -150,6 +176,17 @@ public Map tags() { return this.tags; } + /** + * Set the tags property: A dictionary of tags that can help identify what a key-value may be applicable for. + * + * @param tags the tags value to set. + * @return the KeyValueInner object itself. + */ + public KeyValueInner withTags(Map tags) { + this.tags = tags; + return this; + } + /** * Validates the instance. * diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/OperationDefinitionInner.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/OperationDefinitionInner.java index bf4f4acd50eb9..72892ed70e528 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/OperationDefinitionInner.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/fluent/models/OperationDefinitionInner.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.appconfiguration.models.OperationDefinitionDisplay; +import com.azure.resourcemanager.appconfiguration.models.OperationProperties; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -21,12 +22,30 @@ public final class OperationDefinitionInner { @JsonProperty(value = "name") private String name; + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + /* * The display information for the configuration store operation. */ @JsonProperty(value = "display") private OperationDefinitionDisplay display; + /* + * Origin of the operation + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Properties of the operation + */ + @JsonProperty(value = "properties") + private OperationProperties properties; + /** * Get the name property: Operation name: {provider}/{resource}/{operation}. * @@ -47,6 +66,26 @@ public OperationDefinitionInner withName(String name) { return this; } + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + /** * Get the display property: The display information for the configuration store operation. * @@ -67,6 +106,46 @@ public OperationDefinitionInner withDisplay(OperationDefinitionDisplay display) return this; } + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: Properties of the operation. + * + * @return the properties value. + */ + public OperationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the operation. + * + * @param properties the properties value to set. + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withProperties(OperationProperties properties) { + this.properties = properties; + return this; + } + /** * Validates the instance. * @@ -76,5 +155,8 @@ public void validate() { if (display() != null) { display().validate(); } + if (properties() != null) { + properties().validate(); + } } } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/AppConfigurationManagementClientImpl.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/AppConfigurationManagementClientImpl.java index 294a1ebd95094..64f9055761696 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/AppConfigurationManagementClientImpl.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/AppConfigurationManagementClientImpl.java @@ -23,6 +23,7 @@ import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.appconfiguration.fluent.AppConfigurationManagementClient; import com.azure.resourcemanager.appconfiguration.fluent.ConfigurationStoresClient; +import com.azure.resourcemanager.appconfiguration.fluent.KeyValuesClient; import com.azure.resourcemanager.appconfiguration.fluent.OperationsClient; import com.azure.resourcemanager.appconfiguration.fluent.PrivateEndpointConnectionsClient; import com.azure.resourcemanager.appconfiguration.fluent.PrivateLinkResourcesClient; @@ -161,6 +162,18 @@ public PrivateLinkResourcesClient getPrivateLinkResources() { return this.privateLinkResources; } + /** The KeyValuesClient object to access its operations. */ + private final KeyValuesClient keyValues; + + /** + * Gets the KeyValuesClient object to access its operations. + * + * @return the KeyValuesClient object. + */ + public KeyValuesClient getKeyValues() { + return this.keyValues; + } + /** * Initializes an instance of AppConfigurationManagementClient client. * @@ -183,11 +196,12 @@ public PrivateLinkResourcesClient getPrivateLinkResources() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2020-06-01"; + this.apiVersion = "2021-03-01-preview"; this.configurationStores = new ConfigurationStoresClientImpl(this); this.operations = new OperationsClientImpl(this); this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.keyValues = new KeyValuesClientImpl(this); } /** diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoreImpl.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoreImpl.java index 3a00d1d778e05..6a501f7a00f21 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoreImpl.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoreImpl.java @@ -7,14 +7,13 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.appconfiguration.fluent.models.ConfigurationStoreInner; import com.azure.resourcemanager.appconfiguration.models.ApiKey; import com.azure.resourcemanager.appconfiguration.models.ConfigurationStore; import com.azure.resourcemanager.appconfiguration.models.ConfigurationStoreUpdateParameters; import com.azure.resourcemanager.appconfiguration.models.EncryptionProperties; -import com.azure.resourcemanager.appconfiguration.models.KeyValue; -import com.azure.resourcemanager.appconfiguration.models.ListKeyValueParameters; import com.azure.resourcemanager.appconfiguration.models.PrivateEndpointConnectionReference; import com.azure.resourcemanager.appconfiguration.models.ProvisioningState; import com.azure.resourcemanager.appconfiguration.models.PublicNetworkAccess; @@ -65,6 +64,10 @@ public Sku sku() { return this.innerModel().sku(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } @@ -94,6 +97,10 @@ public PublicNetworkAccess publicNetworkAccess() { return this.innerModel().publicNetworkAccess(); } + public Boolean disableLocalAuth() { + return this.innerModel().disableLocalAuth(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -219,18 +226,6 @@ public Response regenerateKeyWithResponse( .regenerateKeyWithResponse(resourceGroupName, configStoreName, regenerateKeyParameters, context); } - public KeyValue listKeyValue(ListKeyValueParameters listKeyValueParameters) { - return serviceManager - .configurationStores() - .listKeyValue(resourceGroupName, configStoreName, listKeyValueParameters); - } - - public Response listKeyValueWithResponse(ListKeyValueParameters listKeyValueParameters, Context context) { - return serviceManager - .configurationStores() - .listKeyValueWithResponse(resourceGroupName, configStoreName, listKeyValueParameters, context); - } - public ConfigurationStoreImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; @@ -282,11 +277,16 @@ public ConfigurationStoreImpl withEncryption(EncryptionProperties encryption) { } public ConfigurationStoreImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + public ConfigurationStoreImpl withDisableLocalAuth(Boolean disableLocalAuth) { if (isInCreateMode()) { - this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + this.innerModel().withDisableLocalAuth(disableLocalAuth); return this; } else { - this.updateConfigStoreUpdateParameters.withPublicNetworkAccess(publicNetworkAccess); + this.updateConfigStoreUpdateParameters.withDisableLocalAuth(disableLocalAuth); return this; } } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoresClientImpl.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoresClientImpl.java index 88c26a1fa9712..683f4bebe36a6 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoresClientImpl.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoresClientImpl.java @@ -37,11 +37,9 @@ import com.azure.resourcemanager.appconfiguration.fluent.ConfigurationStoresClient; import com.azure.resourcemanager.appconfiguration.fluent.models.ApiKeyInner; import com.azure.resourcemanager.appconfiguration.fluent.models.ConfigurationStoreInner; -import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; import com.azure.resourcemanager.appconfiguration.models.ApiKeyListResult; import com.azure.resourcemanager.appconfiguration.models.ConfigurationStoreListResult; import com.azure.resourcemanager.appconfiguration.models.ConfigurationStoreUpdateParameters; -import com.azure.resourcemanager.appconfiguration.models.ListKeyValueParameters; import com.azure.resourcemanager.appconfiguration.models.RegenerateKeyParameters; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; @@ -167,7 +165,7 @@ Mono>> update( @Headers({"Content-Type: application/json"}) @Post( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration" - + "/configurationStores/{configStoreName}/ListKeys") + + "/configurationStores/{configStoreName}/listKeys") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listKeys( @@ -183,7 +181,7 @@ Mono> listKeys( @Headers({"Content-Type: application/json"}) @Post( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration" - + "/configurationStores/{configStoreName}/RegenerateKey") + + "/configurationStores/{configStoreName}/regenerateKey") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> regenerateKey( @@ -196,22 +194,6 @@ Mono> regenerateKey( @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration" - + "/configurationStores/{configStoreName}/listKeyValue") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listKeyValue( - @HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("configStoreName") String configStoreName, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") ListKeyValueParameters listKeyValueParameters, - @HeaderParam("Accept") String accept, - Context context); - @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @@ -1997,187 +1979,6 @@ public Response regenerateKeyWithResponse( .block(); } - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listKeyValueWithResponseAsync( - String resourceGroupName, String configStoreName, ListKeyValueParameters listKeyValueParameters) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (configStoreName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); - } - if (listKeyValueParameters == null) { - return Mono - .error( - new IllegalArgumentException("Parameter listKeyValueParameters is required and cannot be null.")); - } else { - listKeyValueParameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listKeyValue( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - configStoreName, - this.client.getApiVersion(), - listKeyValueParameters, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listKeyValueWithResponseAsync( - String resourceGroupName, - String configStoreName, - ListKeyValueParameters listKeyValueParameters, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (configStoreName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); - } - if (listKeyValueParameters == null) { - return Mono - .error( - new IllegalArgumentException("Parameter listKeyValueParameters is required and cannot be null.")); - } else { - listKeyValueParameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listKeyValue( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - configStoreName, - this.client.getApiVersion(), - listKeyValueParameters, - accept, - context); - } - - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listKeyValueAsync( - String resourceGroupName, String configStoreName, ListKeyValueParameters listKeyValueParameters) { - return listKeyValueWithResponseAsync(resourceGroupName, configStoreName, listKeyValueParameters) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); - } - - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public KeyValueInner listKeyValue( - String resourceGroupName, String configStoreName, ListKeyValueParameters listKeyValueParameters) { - return listKeyValueAsync(resourceGroupName, configStoreName, listKeyValueParameters).block(); - } - - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listKeyValueWithResponse( - String resourceGroupName, - String configStoreName, - ListKeyValueParameters listKeyValueParameters, - Context context) { - return listKeyValueWithResponseAsync(resourceGroupName, configStoreName, listKeyValueParameters, context) - .block(); - } - /** * Get the next page of items. * diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoresImpl.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoresImpl.java index 1a70ea155d0ef..6bf62e4592432 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoresImpl.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/ConfigurationStoresImpl.java @@ -12,12 +12,9 @@ import com.azure.resourcemanager.appconfiguration.fluent.ConfigurationStoresClient; import com.azure.resourcemanager.appconfiguration.fluent.models.ApiKeyInner; import com.azure.resourcemanager.appconfiguration.fluent.models.ConfigurationStoreInner; -import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; import com.azure.resourcemanager.appconfiguration.models.ApiKey; import com.azure.resourcemanager.appconfiguration.models.ConfigurationStore; import com.azure.resourcemanager.appconfiguration.models.ConfigurationStores; -import com.azure.resourcemanager.appconfiguration.models.KeyValue; -import com.azure.resourcemanager.appconfiguration.models.ListKeyValueParameters; import com.azure.resourcemanager.appconfiguration.models.RegenerateKeyParameters; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -132,37 +129,6 @@ public Response regenerateKeyWithResponse( } } - public KeyValue listKeyValue( - String resourceGroupName, String configStoreName, ListKeyValueParameters listKeyValueParameters) { - KeyValueInner inner = - this.serviceClient().listKeyValue(resourceGroupName, configStoreName, listKeyValueParameters); - if (inner != null) { - return new KeyValueImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response listKeyValueWithResponse( - String resourceGroupName, - String configStoreName, - ListKeyValueParameters listKeyValueParameters, - Context context) { - Response inner = - this - .serviceClient() - .listKeyValueWithResponse(resourceGroupName, configStoreName, listKeyValueParameters, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new KeyValueImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - public ConfigurationStore getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValueImpl.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValueImpl.java index 322952b0bd08a..bc7a3aecfd9ff 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValueImpl.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValueImpl.java @@ -4,21 +4,28 @@ package com.azure.resourcemanager.appconfiguration.implementation; +import com.azure.core.util.Context; import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; import com.azure.resourcemanager.appconfiguration.models.KeyValue; import java.time.OffsetDateTime; import java.util.Collections; import java.util.Map; -public final class KeyValueImpl implements KeyValue { +public final class KeyValueImpl implements KeyValue, KeyValue.Definition, KeyValue.Update { private KeyValueInner innerObject; private final com.azure.resourcemanager.appconfiguration.AppConfigurationManager serviceManager; - KeyValueImpl( - KeyValueInner innerObject, com.azure.resourcemanager.appconfiguration.AppConfigurationManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); } public String key() { @@ -65,4 +72,114 @@ public KeyValueInner innerModel() { private com.azure.resourcemanager.appconfiguration.AppConfigurationManager manager() { return this.serviceManager; } + + private String resourceGroupName; + + private String configStoreName; + + private String keyValueName; + + public KeyValueImpl withExistingConfigurationStore(String resourceGroupName, String configStoreName) { + this.resourceGroupName = resourceGroupName; + this.configStoreName = configStoreName; + return this; + } + + public KeyValue create() { + this.innerObject = + serviceManager + .serviceClient() + .getKeyValues() + .createOrUpdateWithResponse( + resourceGroupName, configStoreName, keyValueName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public KeyValue create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getKeyValues() + .createOrUpdateWithResponse( + resourceGroupName, configStoreName, keyValueName, this.innerModel(), context) + .getValue(); + return this; + } + + KeyValueImpl(String name, com.azure.resourcemanager.appconfiguration.AppConfigurationManager serviceManager) { + this.innerObject = new KeyValueInner(); + this.serviceManager = serviceManager; + this.keyValueName = name; + } + + public KeyValueImpl update() { + return this; + } + + public KeyValue apply() { + this.innerObject = + serviceManager + .serviceClient() + .getKeyValues() + .createOrUpdateWithResponse( + resourceGroupName, configStoreName, keyValueName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public KeyValue apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getKeyValues() + .createOrUpdateWithResponse( + resourceGroupName, configStoreName, keyValueName, this.innerModel(), context) + .getValue(); + return this; + } + + KeyValueImpl( + KeyValueInner innerObject, com.azure.resourcemanager.appconfiguration.AppConfigurationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.configStoreName = Utils.getValueFromIdByName(innerObject.id(), "configurationStores"); + this.keyValueName = Utils.getValueFromIdByName(innerObject.id(), "keyValues"); + } + + public KeyValue refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getKeyValues() + .getWithResponse(resourceGroupName, configStoreName, keyValueName, Context.NONE) + .getValue(); + return this; + } + + public KeyValue refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getKeyValues() + .getWithResponse(resourceGroupName, configStoreName, keyValueName, context) + .getValue(); + return this; + } + + public KeyValueImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public KeyValueImpl withValue(String value) { + this.innerModel().withValue(value); + return this; + } + + public KeyValueImpl withContentType(String contentType) { + this.innerModel().withContentType(contentType); + return this; + } } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValuesClientImpl.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValuesClientImpl.java new file mode 100644 index 0000000000000..f3850be2ae7d6 --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValuesClientImpl.java @@ -0,0 +1,1091 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.appconfiguration.fluent.KeyValuesClient; +import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; +import com.azure.resourcemanager.appconfiguration.models.KeyValueListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in KeyValuesClient. */ +public final class KeyValuesClientImpl implements KeyValuesClient { + private final ClientLogger logger = new ClientLogger(KeyValuesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final KeyValuesService service; + + /** The service client containing this operation class. */ + private final AppConfigurationManagementClientImpl client; + + /** + * Initializes an instance of KeyValuesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + KeyValuesClientImpl(AppConfigurationManagementClientImpl client) { + this.service = + RestProxy.create(KeyValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppConfigurationManagementClientKeyValues to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppConfigurationMana") + private interface KeyValuesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration" + + "/configurationStores/{configStoreName}/keyValues") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByConfigurationStore( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("configStoreName") String configStoreName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration" + + "/configurationStores/{configStoreName}/keyValues/{keyValueName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("configStoreName") String configStoreName, + @QueryParam("api-version") String apiVersion, + @PathParam("keyValueName") String keyValueName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration" + + "/configurationStores/{configStoreName}/keyValues/{keyValueName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("configStoreName") String configStoreName, + @QueryParam("api-version") String apiVersion, + @PathParam("keyValueName") String keyValueName, + @BodyParam("application/json") KeyValueInner keyValueParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration" + + "/configurationStores/{configStoreName}/keyValues/{keyValueName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("configStoreName") String configStoreName, + @QueryParam("api-version") String apiVersion, + @PathParam("keyValueName") String keyValueName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByConfigurationStoreNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param skipToken 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByConfigurationStoreSinglePageAsync( + String resourceGroupName, String configStoreName, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configStoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByConfigurationStore( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + configStoreName, + this.client.getApiVersion(), + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param skipToken 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByConfigurationStoreSinglePageAsync( + String resourceGroupName, String configStoreName, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configStoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByConfigurationStore( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + configStoreName, + this.client.getApiVersion(), + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param skipToken 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByConfigurationStoreAsync( + String resourceGroupName, String configStoreName, String skipToken) { + return new PagedFlux<>( + () -> listByConfigurationStoreSinglePageAsync(resourceGroupName, configStoreName, skipToken), + nextLink -> listByConfigurationStoreNextSinglePageAsync(nextLink)); + } + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByConfigurationStoreAsync(String resourceGroupName, String configStoreName) { + final String skipToken = null; + return new PagedFlux<>( + () -> listByConfigurationStoreSinglePageAsync(resourceGroupName, configStoreName, skipToken), + nextLink -> listByConfigurationStoreNextSinglePageAsync(nextLink)); + } + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param skipToken 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByConfigurationStoreAsync( + String resourceGroupName, String configStoreName, String skipToken, Context context) { + return new PagedFlux<>( + () -> listByConfigurationStoreSinglePageAsync(resourceGroupName, configStoreName, skipToken, context), + nextLink -> listByConfigurationStoreNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByConfigurationStore(String resourceGroupName, String configStoreName) { + final String skipToken = null; + return new PagedIterable<>(listByConfigurationStoreAsync(resourceGroupName, configStoreName, skipToken)); + } + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param skipToken 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByConfigurationStore( + String resourceGroupName, String configStoreName, String skipToken, Context context) { + return new PagedIterable<>( + listByConfigurationStoreAsync(resourceGroupName, configStoreName, skipToken, context)); + } + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String configStoreName, String keyValueName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configStoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); + } + if (keyValueName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyValueName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + configStoreName, + this.client.getApiVersion(), + keyValueName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String configStoreName, String keyValueName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configStoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); + } + if (keyValueName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyValueName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + configStoreName, + this.client.getApiVersion(), + keyValueName, + accept, + context); + } + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String configStoreName, String keyValueName) { + return getWithResponseAsync(resourceGroupName, configStoreName, keyValueName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public KeyValueInner get(String resourceGroupName, String configStoreName, String keyValueName) { + return getAsync(resourceGroupName, configStoreName, keyValueName).block(); + } + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String configStoreName, String keyValueName, Context context) { + return getWithResponseAsync(resourceGroupName, configStoreName, keyValueName, context).block(); + } + + /** + * Creates a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param keyValueParameters The parameters for creating a key-value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the key-value resource along with all resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String configStoreName, String keyValueName, KeyValueInner keyValueParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configStoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); + } + if (keyValueName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyValueName is required and cannot be null.")); + } + if (keyValueParameters != null) { + keyValueParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + configStoreName, + this.client.getApiVersion(), + keyValueName, + keyValueParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param keyValueParameters The parameters for creating a key-value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the key-value resource along with all resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String configStoreName, + String keyValueName, + KeyValueInner keyValueParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configStoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); + } + if (keyValueName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyValueName is required and cannot be null.")); + } + if (keyValueParameters != null) { + keyValueParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + configStoreName, + this.client.getApiVersion(), + keyValueName, + keyValueParameters, + accept, + context); + } + + /** + * Creates a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param keyValueParameters The parameters for creating a key-value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the key-value resource along with all resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String configStoreName, String keyValueName, KeyValueInner keyValueParameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, configStoreName, keyValueName, keyValueParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the key-value resource along with all resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String configStoreName, String keyValueName) { + final KeyValueInner keyValueParameters = null; + return createOrUpdateWithResponseAsync(resourceGroupName, configStoreName, keyValueName, keyValueParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the key-value resource along with all resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public KeyValueInner createOrUpdate(String resourceGroupName, String configStoreName, String keyValueName) { + final KeyValueInner keyValueParameters = null; + return createOrUpdateAsync(resourceGroupName, configStoreName, keyValueName, keyValueParameters).block(); + } + + /** + * Creates a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param keyValueParameters The parameters for creating a key-value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the key-value resource along with all resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String configStoreName, + String keyValueName, + KeyValueInner keyValueParameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, configStoreName, keyValueName, keyValueParameters, context) + .block(); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String configStoreName, String keyValueName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configStoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); + } + if (keyValueName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyValueName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + configStoreName, + this.client.getApiVersion(), + keyValueName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String configStoreName, String keyValueName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (configStoreName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configStoreName is required and cannot be null.")); + } + if (keyValueName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyValueName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + configStoreName, + this.client.getApiVersion(), + keyValueName, + accept, + context); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String configStoreName, String keyValueName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, configStoreName, keyValueName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String configStoreName, String keyValueName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, configStoreName, keyValueName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String configStoreName, String keyValueName) { + return beginDeleteAsync(resourceGroupName, configStoreName, keyValueName).getSyncPoller(); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String configStoreName, String keyValueName, Context context) { + return beginDeleteAsync(resourceGroupName, configStoreName, keyValueName, context).getSyncPoller(); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String configStoreName, String keyValueName) { + return beginDeleteAsync(resourceGroupName, configStoreName, keyValueName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String configStoreName, String keyValueName, Context context) { + return beginDeleteAsync(resourceGroupName, configStoreName, keyValueName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String configStoreName, String keyValueName) { + deleteAsync(resourceGroupName, configStoreName, keyValueName).block(); + } + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String configStoreName, String keyValueName, Context context) { + deleteAsync(resourceGroupName, configStoreName, keyValueName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByConfigurationStoreNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByConfigurationStoreNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByConfigurationStoreNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByConfigurationStoreNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValuesImpl.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValuesImpl.java new file mode 100644 index 0000000000000..3a131c3c738a4 --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/KeyValuesImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appconfiguration.fluent.KeyValuesClient; +import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; +import com.azure.resourcemanager.appconfiguration.models.KeyValue; +import com.azure.resourcemanager.appconfiguration.models.KeyValues; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class KeyValuesImpl implements KeyValues { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyValuesImpl.class); + + private final KeyValuesClient innerClient; + + private final com.azure.resourcemanager.appconfiguration.AppConfigurationManager serviceManager; + + public KeyValuesImpl( + KeyValuesClient innerClient, + com.azure.resourcemanager.appconfiguration.AppConfigurationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByConfigurationStore(String resourceGroupName, String configStoreName) { + PagedIterable inner = + this.serviceClient().listByConfigurationStore(resourceGroupName, configStoreName); + return Utils.mapPage(inner, inner1 -> new KeyValueImpl(inner1, this.manager())); + } + + public PagedIterable listByConfigurationStore( + String resourceGroupName, String configStoreName, String skipToken, Context context) { + PagedIterable inner = + this.serviceClient().listByConfigurationStore(resourceGroupName, configStoreName, skipToken, context); + return Utils.mapPage(inner, inner1 -> new KeyValueImpl(inner1, this.manager())); + } + + public KeyValue get(String resourceGroupName, String configStoreName, String keyValueName) { + KeyValueInner inner = this.serviceClient().get(resourceGroupName, configStoreName, keyValueName); + if (inner != null) { + return new KeyValueImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String configStoreName, String keyValueName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, configStoreName, keyValueName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new KeyValueImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String configStoreName, String keyValueName) { + this.serviceClient().delete(resourceGroupName, configStoreName, keyValueName); + } + + public void delete(String resourceGroupName, String configStoreName, String keyValueName, Context context) { + this.serviceClient().delete(resourceGroupName, configStoreName, keyValueName, context); + } + + public KeyValue getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String configStoreName = Utils.getValueFromIdByName(id, "configurationStores"); + if (configStoreName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'configurationStores'.", id))); + } + String keyValueName = Utils.getValueFromIdByName(id, "keyValues"); + if (keyValueName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keyValues'.", id))); + } + return this.getWithResponse(resourceGroupName, configStoreName, keyValueName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String configStoreName = Utils.getValueFromIdByName(id, "configurationStores"); + if (configStoreName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'configurationStores'.", id))); + } + String keyValueName = Utils.getValueFromIdByName(id, "keyValues"); + if (keyValueName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keyValues'.", id))); + } + return this.getWithResponse(resourceGroupName, configStoreName, keyValueName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String configStoreName = Utils.getValueFromIdByName(id, "configurationStores"); + if (configStoreName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'configurationStores'.", id))); + } + String keyValueName = Utils.getValueFromIdByName(id, "keyValues"); + if (keyValueName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keyValues'.", id))); + } + this.delete(resourceGroupName, configStoreName, keyValueName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String configStoreName = Utils.getValueFromIdByName(id, "configurationStores"); + if (configStoreName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'configurationStores'.", id))); + } + String keyValueName = Utils.getValueFromIdByName(id, "keyValues"); + if (keyValueName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keyValues'.", id))); + } + this.delete(resourceGroupName, configStoreName, keyValueName, context); + } + + private KeyValuesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.appconfiguration.AppConfigurationManager manager() { + return this.serviceManager; + } + + public KeyValueImpl define(String name) { + return new KeyValueImpl(name, this.manager()); + } +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/OperationDefinitionImpl.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/OperationDefinitionImpl.java index 0c3a297061bfc..dd15c4b4a84e0 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/OperationDefinitionImpl.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/implementation/OperationDefinitionImpl.java @@ -7,6 +7,7 @@ import com.azure.resourcemanager.appconfiguration.fluent.models.OperationDefinitionInner; import com.azure.resourcemanager.appconfiguration.models.OperationDefinition; import com.azure.resourcemanager.appconfiguration.models.OperationDefinitionDisplay; +import com.azure.resourcemanager.appconfiguration.models.OperationProperties; public final class OperationDefinitionImpl implements OperationDefinition { private OperationDefinitionInner innerObject; @@ -24,10 +25,22 @@ public String name() { return this.innerModel().name(); } + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + public OperationDefinitionDisplay display() { return this.innerModel().display(); } + public String origin() { + return this.innerModel().origin(); + } + + public OperationProperties properties() { + return this.innerModel().properties(); + } + public OperationDefinitionInner innerModel() { return this.innerObject; } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStore.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStore.java index a6fa34b3f7c29..bcd54c1170e0e 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStore.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStore.java @@ -7,6 +7,7 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.appconfiguration.fluent.models.ConfigurationStoreInner; import java.time.OffsetDateTime; @@ -64,6 +65,13 @@ public interface ConfigurationStore { */ Sku sku(); + /** + * Gets the systemData property: Resource system metadata. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the provisioningState property: The provisioning state of the configuration store. * @@ -108,6 +116,13 @@ public interface ConfigurationStore { */ PublicNetworkAccess publicNetworkAccess(); + /** + * Gets the disableLocalAuth property: Disables all authentication methods other than AAD authentication. + * + * @return the disableLocalAuth value. + */ + Boolean disableLocalAuth(); + /** * Gets the region of the resource. * @@ -188,7 +203,8 @@ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithEncryption, - DefinitionStages.WithPublicNetworkAccess { + DefinitionStages.WithPublicNetworkAccess, + DefinitionStages.WithDisableLocalAuth { /** * Executes the create request. * @@ -246,6 +262,17 @@ interface WithPublicNetworkAccess { */ WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); } + /** The stage of the ConfigurationStore definition allowing to specify disableLocalAuth. */ + interface WithDisableLocalAuth { + /** + * Specifies the disableLocalAuth property: Disables all authentication methods other than AAD + * authentication.. + * + * @param disableLocalAuth Disables all authentication methods other than AAD authentication. + * @return the next definition stage. + */ + WithCreate withDisableLocalAuth(Boolean disableLocalAuth); + } } /** * Begins update for the ConfigurationStore resource. @@ -260,7 +287,7 @@ interface Update UpdateStages.WithIdentity, UpdateStages.WithSku, UpdateStages.WithEncryption, - UpdateStages.WithPublicNetworkAccess { + UpdateStages.WithDisableLocalAuth { /** * Executes the update request. * @@ -318,17 +345,16 @@ interface WithEncryption { */ Update withEncryption(EncryptionProperties encryption); } - /** The stage of the ConfigurationStore update allowing to specify publicNetworkAccess. */ - interface WithPublicNetworkAccess { + /** The stage of the ConfigurationStore update allowing to specify disableLocalAuth. */ + interface WithDisableLocalAuth { /** - * Specifies the publicNetworkAccess property: Control permission for data plane traffic coming from public - * networks while private endpoint is enabled.. + * Specifies the disableLocalAuth property: Disables all authentication methods other than AAD + * authentication.. * - * @param publicNetworkAccess Control permission for data plane traffic coming from public networks while - * private endpoint is enabled. + * @param disableLocalAuth Disables all authentication methods other than AAD authentication. * @return the next definition stage. */ - Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + Update withDisableLocalAuth(Boolean disableLocalAuth); } } /** @@ -391,27 +417,4 @@ interface WithPublicNetworkAccess { * @return an API key used for authenticating with a configuration store endpoint. */ Response regenerateKeyWithResponse(RegenerateKeyParameters regenerateKeyParameters, Context context); - - /** - * Lists a configuration store key-value. - * - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - KeyValue listKeyValue(ListKeyValueParameters listKeyValueParameters); - - /** - * Lists a configuration store key-value. - * - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - Response listKeyValueWithResponse(ListKeyValueParameters listKeyValueParameters, Context context); } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStoreUpdateParameters.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStoreUpdateParameters.java index ac7b7f6fe8c4c..1b70b704d2887 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStoreUpdateParameters.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStoreUpdateParameters.java @@ -42,11 +42,10 @@ public class ConfigurationStoreUpdateParameters { private EncryptionProperties encryption; /* - * Control permission for data plane traffic coming from public networks - * while private endpoint is enabled. + * Disables all authentication methods other than AAD authentication. */ - @JsonProperty(value = "properties.publicNetworkAccess") - private PublicNetworkAccess publicNetworkAccess; + @JsonProperty(value = "properties.disableLocalAuth") + private Boolean disableLocalAuth; /** * Get the identity property: The managed identity information for the configuration store. @@ -129,24 +128,22 @@ public ConfigurationStoreUpdateParameters withEncryption(EncryptionProperties en } /** - * Get the publicNetworkAccess property: Control permission for data plane traffic coming from public networks while - * private endpoint is enabled. + * Get the disableLocalAuth property: Disables all authentication methods other than AAD authentication. * - * @return the publicNetworkAccess value. + * @return the disableLocalAuth value. */ - public PublicNetworkAccess publicNetworkAccess() { - return this.publicNetworkAccess; + public Boolean disableLocalAuth() { + return this.disableLocalAuth; } /** - * Set the publicNetworkAccess property: Control permission for data plane traffic coming from public networks while - * private endpoint is enabled. + * Set the disableLocalAuth property: Disables all authentication methods other than AAD authentication. * - * @param publicNetworkAccess the publicNetworkAccess value to set. + * @param disableLocalAuth the disableLocalAuth value to set. * @return the ConfigurationStoreUpdateParameters object itself. */ - public ConfigurationStoreUpdateParameters withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { - this.publicNetworkAccess = publicNetworkAccess; + public ConfigurationStoreUpdateParameters withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; return this; } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStores.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStores.java index 7f309f257a7e0..a2c5bc948b176 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStores.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ConfigurationStores.java @@ -168,38 +168,6 @@ Response regenerateKeyWithResponse( RegenerateKeyParameters regenerateKeyParameters, Context context); - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - KeyValue listKeyValue( - String resourceGroupName, String configStoreName, ListKeyValueParameters listKeyValueParameters); - - /** - * Lists a configuration store key-value. - * - * @param resourceGroupName The name of the resource group to which the container registry belongs. - * @param configStoreName The name of the configuration store. - * @param listKeyValueParameters The parameters for retrieving a key-value. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a request to retrieve a key-value from the specified configuration store. - */ - Response listKeyValueWithResponse( - String resourceGroupName, - String configStoreName, - ListKeyValueParameters listKeyValueParameters, - Context context); - /** * Gets the properties of the specified configuration store. * diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValue.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValue.java index e7912456acefa..ccfe4086a097a 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValue.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValue.java @@ -4,12 +4,34 @@ package com.azure.resourcemanager.appconfiguration.models; +import com.azure.core.util.Context; import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; import java.time.OffsetDateTime; import java.util.Map; /** An immutable client-side representation of KeyValue. */ public interface KeyValue { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + /** * Gets the key property: The primary identifier of a key-value. The key is used in unison with the label to * uniquely identify a key-value. @@ -76,4 +98,154 @@ public interface KeyValue { * @return the inner object. */ KeyValueInner innerModel(); + + /** The entirety of the KeyValue definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The KeyValue definition stages. */ + interface DefinitionStages { + /** The first stage of the KeyValue definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the KeyValue definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, configStoreName. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @return the next definition stage. + */ + WithCreate withExistingConfigurationStore(String resourceGroupName, String configStoreName); + } + /** + * The stage of the KeyValue definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithValue, DefinitionStages.WithContentType { + /** + * Executes the create request. + * + * @return the created resource. + */ + KeyValue create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + KeyValue create(Context context); + } + /** The stage of the KeyValue definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: A dictionary of tags that can help identify what a key-value may be + * applicable for.. + * + * @param tags A dictionary of tags that can help identify what a key-value may be applicable for. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the KeyValue definition allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: The value of the key-value.. + * + * @param value The value of the key-value. + * @return the next definition stage. + */ + WithCreate withValue(String value); + } + /** The stage of the KeyValue definition allowing to specify contentType. */ + interface WithContentType { + /** + * Specifies the contentType property: 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.. + * + * @param contentType 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. + * @return the next definition stage. + */ + WithCreate withContentType(String contentType); + } + } + /** + * Begins update for the KeyValue resource. + * + * @return the stage of resource update. + */ + KeyValue.Update update(); + + /** The template for KeyValue update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithValue, UpdateStages.WithContentType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + KeyValue apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + KeyValue apply(Context context); + } + /** The KeyValue update stages. */ + interface UpdateStages { + /** The stage of the KeyValue update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: A dictionary of tags that can help identify what a key-value may be + * applicable for.. + * + * @param tags A dictionary of tags that can help identify what a key-value may be applicable for. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the KeyValue update allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: The value of the key-value.. + * + * @param value The value of the key-value. + * @return the next definition stage. + */ + Update withValue(String value); + } + /** The stage of the KeyValue update allowing to specify contentType. */ + interface WithContentType { + /** + * Specifies the contentType property: 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.. + * + * @param contentType 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. + * @return the next definition stage. + */ + Update withContentType(String contentType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + KeyValue refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + KeyValue refresh(Context context); } diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValueListResult.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValueListResult.java new file mode 100644 index 0000000000000..886dbf1d8018a --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValueListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.appconfiguration.fluent.models.KeyValueInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of a request to list key-values. */ +@Fluent +public final class KeyValueListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyValueListResult.class); + + /* + * The collection value. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI that can be used to request the next set of paged results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The collection value. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection value. + * + * @param value the value value to set. + * @return the KeyValueListResult object itself. + */ + public KeyValueListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI that can be used to request the next set of paged results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI that can be used to request the next set of paged results. + * + * @param nextLink the nextLink value to set. + * @return the KeyValueListResult object itself. + */ + public KeyValueListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValues.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValues.java new file mode 100644 index 0000000000000..6d86e0a29232a --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/KeyValues.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of KeyValues. */ +public interface KeyValues { + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + PagedIterable listByConfigurationStore(String resourceGroupName, String configStoreName); + + /** + * Lists the key-values for a given configuration store. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param skipToken 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a request to list key-values. + */ + PagedIterable listByConfigurationStore( + String resourceGroupName, String configStoreName, String skipToken, Context context); + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + KeyValue get(String resourceGroupName, String configStoreName, String keyValueName); + + /** + * Gets the properties of the specified key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + Response getWithResponse( + String resourceGroupName, String configStoreName, String keyValueName, Context context); + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String configStoreName, String keyValueName); + + /** + * Deletes a key-value. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param keyValueName Identifier of key and label combination. Key and label are joined by $ character. Label is + * optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String configStoreName, String keyValueName, Context context); + + /** + * Gets the properties of the specified key-value. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + KeyValue getById(String id); + + /** + * Gets the properties of the specified key-value. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified key-value. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a key-value. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a key-value. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new KeyValue resource. + * + * @param name resource name. + * @return the first stage of the new KeyValue definition. + */ + KeyValue.DefinitionStages.Blank define(String name); +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ListKeyValueParameters.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ListKeyValueParameters.java deleted file mode 100644 index 46ca1f798e637..0000000000000 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ListKeyValueParameters.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.appconfiguration.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The parameters used to list a configuration store key-value. */ -@Fluent -public final class ListKeyValueParameters { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ListKeyValueParameters.class); - - /* - * The key to retrieve. - */ - @JsonProperty(value = "key", required = true) - private String key; - - /* - * The label of the key. - */ - @JsonProperty(value = "label") - private String label; - - /** - * Get the key property: The key to retrieve. - * - * @return the key value. - */ - public String key() { - return this.key; - } - - /** - * Set the key property: The key to retrieve. - * - * @param key the key value to set. - * @return the ListKeyValueParameters object itself. - */ - public ListKeyValueParameters withKey(String key) { - this.key = key; - return this; - } - - /** - * Get the label property: The label of the key. - * - * @return the label value. - */ - public String label() { - return this.label; - } - - /** - * Set the label property: The label of the key. - * - * @param label the label value to set. - * @return the ListKeyValueParameters object itself. - */ - public ListKeyValueParameters withLabel(String label) { - this.label = label; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (key() == null) { - throw logger - .logExceptionAsError( - new IllegalArgumentException("Missing required property key in model ListKeyValueParameters")); - } - } -} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/LogSpecification.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/LogSpecification.java new file mode 100644 index 0000000000000..96538a43a5f84 --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/LogSpecification.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifications of the Log for Azure Monitoring. */ +@Fluent +public final class LogSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogSpecification.class); + + /* + * Name of the log + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized friendly display name of the log + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Blob duration of the log + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /** + * Get the name property: Name of the log. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the log. + * + * @param name the name value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized friendly display name of the log. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized friendly display name of the log. + * + * @param displayName the displayName value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the blobDuration property: Blob duration of the log. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set the blobDuration property: Blob duration of the log. + * + * @param blobDuration the blobDuration value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/MetricDimension.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/MetricDimension.java new file mode 100644 index 0000000000000..a4e88184df722 --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/MetricDimension.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifications of the Dimension of metrics. */ +@Fluent +public final class MetricDimension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDimension.class); + + /* + * Name of the dimension + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized friendly display name of the dimension + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Internal name of the dimension. + */ + @JsonProperty(value = "internalName") + private String internalName; + + /** + * Get the name property: Name of the dimension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the dimension. + * + * @param name the name value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized friendly display name of the dimension. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized friendly display name of the dimension. + * + * @param displayName the displayName value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the internalName property: Internal name of the dimension. + * + * @return the internalName value. + */ + public String internalName() { + return this.internalName; + } + + /** + * Set the internalName property: Internal name of the dimension. + * + * @param internalName the internalName value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withInternalName(String internalName) { + this.internalName = internalName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/MetricSpecification.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/MetricSpecification.java new file mode 100644 index 0000000000000..a06b9356c4de4 --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/MetricSpecification.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifications of the Metrics for Azure Monitoring. */ +@Fluent +public final class MetricSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricSpecification.class); + + /* + * Name of the metric + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized friendly display name of the metric + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Localized friendly description of the metric + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /* + * Unit that makes sense for the metric + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * Only provide one value for this field. Valid values: Average, Minimum, + * Maximum, Total, Count. + */ + @JsonProperty(value = "aggregationType") + private String aggregationType; + + /* + * Internal metric name. + */ + @JsonProperty(value = "internalMetricName") + private String internalMetricName; + + /* + * Dimensions of the metric + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /* + * Optional. If set to true, then zero will be returned for time duration + * where no metric is emitted/published. + */ + @JsonProperty(value = "fillGapWithZero") + private Boolean fillGapWithZero; + + /** + * Get the name property: Name of the metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the metric. + * + * @param name the name value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized friendly display name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized friendly display name of the metric. + * + * @param displayName the displayName value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the displayDescription property: Localized friendly description of the metric. + * + * @return the displayDescription value. + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set the displayDescription property: Localized friendly description of the metric. + * + * @param displayDescription the displayDescription value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get the unit property: Unit that makes sense for the metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: Unit that makes sense for the metric. + * + * @param unit the unit value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the aggregationType property: Only provide one value for this field. Valid values: Average, Minimum, Maximum, + * Total, Count. + * + * @return the aggregationType value. + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set the aggregationType property: Only provide one value for this field. Valid values: Average, Minimum, Maximum, + * Total, Count. + * + * @param aggregationType the aggregationType value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get the internalMetricName property: Internal metric name. + * + * @return the internalMetricName value. + */ + public String internalMetricName() { + return this.internalMetricName; + } + + /** + * Set the internalMetricName property: Internal metric name. + * + * @param internalMetricName the internalMetricName value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withInternalMetricName(String internalMetricName) { + this.internalMetricName = internalMetricName; + return this; + } + + /** + * Get the dimensions property: Dimensions of the metric. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: Dimensions of the metric. + * + * @param dimensions the dimensions value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the fillGapWithZero property: Optional. If set to true, then zero will be returned for time duration where no + * metric is emitted/published. + * + * @return the fillGapWithZero value. + */ + public Boolean fillGapWithZero() { + return this.fillGapWithZero; + } + + /** + * Set the fillGapWithZero property: Optional. If set to true, then zero will be returned for time duration where no + * metric is emitted/published. + * + * @param fillGapWithZero the fillGapWithZero value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withFillGapWithZero(Boolean fillGapWithZero) { + this.fillGapWithZero = fillGapWithZero; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/OperationDefinition.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/OperationDefinition.java index da3c044bc5814..fd8968790487c 100644 --- a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/OperationDefinition.java +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/OperationDefinition.java @@ -15,6 +15,13 @@ public interface OperationDefinition { */ String name(); + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + /** * Gets the display property: The display information for the configuration store operation. * @@ -22,6 +29,20 @@ public interface OperationDefinition { */ OperationDefinitionDisplay display(); + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: Properties of the operation. + * + * @return the properties value. + */ + OperationProperties properties(); + /** * Gets the inner com.azure.resourcemanager.appconfiguration.fluent.models.OperationDefinitionInner object. * diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/OperationProperties.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/OperationProperties.java new file mode 100644 index 0000000000000..ab712c5159d84 --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/OperationProperties.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Extra Operation properties. */ +@Fluent +public final class OperationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationProperties.class); + + /* + * Service specifications of the operation + */ + @JsonProperty(value = "serviceSpecification") + private ServiceSpecification serviceSpecification; + + /** + * Get the serviceSpecification property: Service specifications of the operation. + * + * @return the serviceSpecification value. + */ + public ServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the serviceSpecification property: Service specifications of the operation. + * + * @param serviceSpecification the serviceSpecification value to set. + * @return the OperationProperties object itself. + */ + public OperationProperties withServiceSpecification(ServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceSpecification() != null) { + serviceSpecification().validate(); + } + } +} diff --git a/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ServiceSpecification.java b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ServiceSpecification.java new file mode 100644 index 0000000000000..6f631f6d6a90b --- /dev/null +++ b/sdk/appconfiguration/azure-resourcemanager-appconfiguration/src/main/java/com/azure/resourcemanager/appconfiguration/models/ServiceSpecification.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.appconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Service specification payload. */ +@Fluent +public final class ServiceSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceSpecification.class); + + /* + * Specifications of the Log for Azure Monitoring + */ + @JsonProperty(value = "logSpecifications") + private List logSpecifications; + + /* + * Specifications of the Metrics for Azure Monitoring + */ + @JsonProperty(value = "metricSpecifications") + private List metricSpecifications; + + /** + * Get the logSpecifications property: Specifications of the Log for Azure Monitoring. + * + * @return the logSpecifications value. + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Set the logSpecifications property: Specifications of the Log for Azure Monitoring. + * + * @param logSpecifications the logSpecifications value to set. + * @return the ServiceSpecification object itself. + */ + public ServiceSpecification withLogSpecifications(List logSpecifications) { + this.logSpecifications = logSpecifications; + return this; + } + + /** + * Get the metricSpecifications property: Specifications of the Metrics for Azure Monitoring. + * + * @return the metricSpecifications value. + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Set the metricSpecifications property: Specifications of the Metrics for Azure Monitoring. + * + * @param metricSpecifications the metricSpecifications value to set. + * @return the ServiceSpecification object itself. + */ + public ServiceSpecification withMetricSpecifications(List metricSpecifications) { + this.metricSpecifications = metricSpecifications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logSpecifications() != null) { + logSpecifications().forEach(e -> e.validate()); + } + if (metricSpecifications() != null) { + metricSpecifications().forEach(e -> e.validate()); + } + } +}