From b597c6e48c117b37c2fbdd7d696fc209339c01ad Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 24 Apr 2019 18:14:30 -0700 Subject: [PATCH] [AutoPR appconfiguration/resource-manager] 2019-02-01-preview (#3408) * Generated from 2bb0f75efee5b84434edfe63a1ad73d74749ee95 2019-02-01-preview * Generated from ed4c436bb8fe501958dc615138eb68deabc3ebf4 Added ruby spec. Removed Node spec. Fixed spelling error in 'utilizing'. Removed BOM from the beginning of example files. --- .../CheckNameAvailabilityParameters.java | 77 + .../ConfigurationStoreUpdateParameters.java | 70 + .../management/appconfiguration/Error.java | 69 + .../appconfiguration/ErrorException.java | 44 + .../OperationDefinitionDisplay.java | 110 + .../appconfiguration/ProvisioningState.java | 53 + .../RegenerateKeyParameters.java | 43 + .../implementation/ApiKeyInner.java | 109 + .../AppConfigurationManagementClientImpl.java | 210 ++ .../ConfigurationStoreInner.java | 70 + .../ConfigurationStoresInner.java | 1908 +++++++++++++++++ .../NameAvailabilityStatusInner.java | 63 + .../OperationDefinitionInner.java | 70 + .../implementation/OperationsInner.java | 476 ++++ .../implementation/PageImpl.java | 75 + .../implementation/package-info.java | 10 + .../appconfiguration/package-info.java | 10 + 17 files changed, 3467 insertions(+) create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/CheckNameAvailabilityParameters.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ConfigurationStoreUpdateParameters.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/Error.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ErrorException.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/OperationDefinitionDisplay.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ProvisioningState.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/RegenerateKeyParameters.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ApiKeyInner.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/AppConfigurationManagementClientImpl.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ConfigurationStoreInner.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ConfigurationStoresInner.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/NameAvailabilityStatusInner.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/OperationDefinitionInner.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/OperationsInner.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/PageImpl.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/package-info.java create mode 100644 azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/package-info.java diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/CheckNameAvailabilityParameters.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/CheckNameAvailabilityParameters.java new file mode 100644 index 0000000000000..08c5d497572e2 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/CheckNameAvailabilityParameters.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters used for checking whether a resource name is available. + */ +public class CheckNameAvailabilityParameters { + /** + * The name to check for availability. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The resource type to check for name availability. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of CheckNameAvailabilityParameters class. + * @param name the name to check for availability. + */ + public CheckNameAvailabilityParameters() { + type = "Microsoft.AppConfiguration/configurationStores"; + } + + /** + * Get the name to check for availability. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name to check for availability. + * + * @param name the name value to set + * @return the CheckNameAvailabilityParameters object itself. + */ + public CheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resource type to check for name availability. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the resource type to check for name availability. + * + * @param type the type value to set + * @return the CheckNameAvailabilityParameters object itself. + */ + public CheckNameAvailabilityParameters withType(String type) { + this.type = type; + return this; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ConfigurationStoreUpdateParameters.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ConfigurationStoreUpdateParameters.java new file mode 100644 index 0000000000000..23118cc591e64 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ConfigurationStoreUpdateParameters.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters for updating a configuration store. + */ +public class ConfigurationStoreUpdateParameters { + /** + * The properties for updating a configuration store. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * The ARM resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the properties for updating a configuration store. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties for updating a configuration store. + * + * @param properties the properties value to set + * @return the ConfigurationStoreUpdateParameters object itself. + */ + public ConfigurationStoreUpdateParameters withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the ARM resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the ARM resource tags. + * + * @param tags the tags value to set + * @return the ConfigurationStoreUpdateParameters object itself. + */ + public ConfigurationStoreUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/Error.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/Error.java new file mode 100644 index 0000000000000..809d872d6ae7c --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/Error.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * AppConfiguration error object. + */ +public class Error { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the Error object itself. + */ + public Error withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ErrorException.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ErrorException.java new file mode 100644 index 0000000000000..274c9caed5f7e --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ErrorException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with Error information. + */ +public class ErrorException extends RestException { + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorException(final String message, final Response response, final Error body) { + super(message, response, body); + } + + @Override + public Error body() { + return (Error) super.body(); + } +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/OperationDefinitionDisplay.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/OperationDefinitionDisplay.java new file mode 100644 index 0000000000000..e4b6351b3f21a --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/OperationDefinitionDisplay.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The display information for a configuration store operation. + */ +public class OperationDefinitionDisplay { + /** + * The resource provider name: Microsoft App Configuration.". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * The resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * The operation that users can perform. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * The description for the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the resource provider name: Microsoft App Configuration.". + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDefinitionDisplay object itself. + */ + public OperationDefinitionDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation that users can perform. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation that users can perform. + * + * @param operation the operation value to set + * @return the OperationDefinitionDisplay object itself. + */ + public OperationDefinitionDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description for the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description for the operation. + * + * @param description the description value to set + * @return the OperationDefinitionDisplay object itself. + */ + public OperationDefinitionDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ProvisioningState.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ProvisioningState.java new file mode 100644 index 0000000000000..a213ad93a31cc --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/ProvisioningState.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/RegenerateKeyParameters.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/RegenerateKeyParameters.java new file mode 100644 index 0000000000000..5fbaeacfcc249 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/RegenerateKeyParameters.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters used to regenerate an API key. + */ +public class RegenerateKeyParameters { + /** + * The id of the key to regenerate. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id of the key to regenerate. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id of the key to regenerate. + * + * @param id the id value to set + * @return the RegenerateKeyParameters object itself. + */ + public RegenerateKeyParameters withId(String id) { + this.id = id; + return this; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ApiKeyInner.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ApiKeyInner.java new file mode 100644 index 0000000000000..7805d15731023 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ApiKeyInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An API key used for authenticating with a configuration store endpoint. + */ +public class ApiKeyInner { + /** + * The key ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * A name for the key describing its usage. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The value of the key that is used for authentication purposes. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * A connection string that can be used by supporting clients for + * authentication. + */ + @JsonProperty(value = "connectionString", access = JsonProperty.Access.WRITE_ONLY) + private String connectionString; + + /** + * The last time any of the key's properties were modified. + */ + @JsonProperty(value = "lastModified", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModified; + + /** + * Whether this key can only be used for read operations. + */ + @JsonProperty(value = "readOnly", access = JsonProperty.Access.WRITE_ONLY) + private Boolean readOnly; + + /** + * Get the key ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get a name for the key describing its usage. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the value of the key that is used for authentication purposes. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Get a connection string that can be used by supporting clients for authentication. + * + * @return the connectionString value + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Get the last time any of the key's properties were modified. + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Get whether this key can only be used for read operations. + * + * @return the readOnly value + */ + public Boolean readOnly() { + return this.readOnly; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/AppConfigurationManagementClientImpl.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/AppConfigurationManagementClientImpl.java new file mode 100644 index 0000000000000..8de53612c580f --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/AppConfigurationManagementClientImpl.java @@ -0,0 +1,210 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the AppConfigurationManagementClientImpl class. + */ +public class AppConfigurationManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Microsoft Azure subscription ID. */ + private String subscriptionId; + + /** + * Gets The Microsoft Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Microsoft Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AppConfigurationManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The client API version. */ + private String apiVersion; + + /** + * Gets The client API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AppConfigurationManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AppConfigurationManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AppConfigurationManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ConfigurationStoresInner object to access its operations. + */ + private ConfigurationStoresInner configurationStores; + + /** + * Gets the ConfigurationStoresInner object to access its operations. + * @return the ConfigurationStoresInner object. + */ + public ConfigurationStoresInner configurationStores() { + return this.configurationStores; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of AppConfigurationManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public AppConfigurationManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of AppConfigurationManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AppConfigurationManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of AppConfigurationManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AppConfigurationManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-02-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.configurationStores = new ConfigurationStoresInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "AppConfigurationManagementClient", "2019-02-01-preview"); + } +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ConfigurationStoreInner.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ConfigurationStoreInner.java new file mode 100644 index 0000000000000..7540278b5e802 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ConfigurationStoreInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration.implementation; + +import com.microsoft.azure.management.appconfiguration.ProvisioningState; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The configuration store along with all resource properties. The + * Configuration Store will have all information to begin utilizing it. + */ +@JsonFlatten +public class ConfigurationStoreInner extends Resource { + /** + * The provisioning state of the configuration store. Possible values + * include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + * 'Canceled'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The creation date of configuration store. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The DNS endpoint where the configuration store API will be available. + */ + @JsonProperty(value = "properties.endpoint", access = JsonProperty.Access.WRITE_ONLY) + private String endpoint; + + /** + * Get the provisioning state of the configuration store. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the creation date of configuration store. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the DNS endpoint where the configuration store API will be available. + * + * @return the endpoint value + */ + public String endpoint() { + return this.endpoint; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ConfigurationStoresInner.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ConfigurationStoresInner.java new file mode 100644 index 0000000000000..5e2a664135f83 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/ConfigurationStoresInner.java @@ -0,0 +1,1908 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.appconfiguration.ConfigurationStoreUpdateParameters; +import com.microsoft.azure.management.appconfiguration.ErrorException; +import com.microsoft.azure.management.appconfiguration.RegenerateKeyParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ConfigurationStores. + */ +public class ConfigurationStoresInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ConfigurationStoresService service; + /** The service client containing this operation class. */ + private AppConfigurationManagementClientImpl client; + + /** + * Initializes an instance of ConfigurationStoresInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ConfigurationStoresInner(Retrofit retrofit, AppConfigurationManagementClientImpl client) { + this.service = retrofit.create(ConfigurationStoresService.class); + this.client = client; + } + + /** + * The interface defining all the services for ConfigurationStores to be + * used by Retrofit to perform actually REST calls. + */ + interface ConfigurationStoresService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skipToken") String skipToken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Query("$skipToken") String skipToken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Body ConfigurationStoreInner configStoreCreationParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Body ConfigurationStoreInner configStoreCreationParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Body ConfigurationStoreUpdateParameters configStoreUpdateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Body ConfigurationStoreUpdateParameters configStoreUpdateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/ListKeys") + Observable> listKeys(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Query("$skipToken") String skipToken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores regenerateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/RegenerateKey") + Observable> regenerateKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("configStoreName") String configStoreName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateKeyParameters regenerateKeyParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.ConfigurationStores listKeysNext" }) + @GET + Observable> listKeysNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the configuration stores for a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ConfigurationStoreInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the configuration stores for a given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConfigurationStoreInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String skipToken = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ConfigurationStoreInner> object if successful. + */ + public PagedList list(final String skipToken) { + ServiceResponse> response = listSinglePageAsync(skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the configuration stores for a given subscription. + * + * @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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @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 + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable> listAsync(final String skipToken) { + return listWithServiceResponseAsync(skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @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 + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable>> listWithServiceResponseAsync(final String skipToken) { + return listSinglePageAsync(skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the configuration stores for a given subscription. + * + ServiceResponse> * @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 + * @return the PagedList<ConfigurationStoreInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String skipToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ConfigurationStoreInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConfigurationStoreInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String skipToken = null; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ConfigurationStoreInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String skipToken) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @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 + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String skipToken) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @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 + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String skipToken) { + return listByResourceGroupSinglePageAsync(resourceGroupName, skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the configuration stores for a given resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group to which the container registry belongs. + ServiceResponse> * @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 + * @return the PagedList<ConfigurationStoreInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String skipToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Gets the properties of the specified 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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationStoreInner object if successful. + */ + public ConfigurationStoreInner getByResourceGroup(String resourceGroupName, String configStoreName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, configStoreName).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String configStoreName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, configStoreName), serviceCallback); + } + + /** + * Gets the properties of the specified 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 + * @return the observable to the ConfigurationStoreInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String configStoreName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, configStoreName).map(new Func1, ConfigurationStoreInner>() { + @Override + public ConfigurationStoreInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified 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 + * @return the observable to the ConfigurationStoreInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String configStoreName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Creates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreCreationParameters The parameters for creating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationStoreInner object if successful. + */ + public ConfigurationStoreInner create(String resourceGroupName, String configStoreName, ConfigurationStoreInner configStoreCreationParameters) { + return createWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreCreationParameters).toBlocking().last().body(); + } + + /** + * Creates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreCreationParameters The parameters for creating a configuration store. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String configStoreName, ConfigurationStoreInner configStoreCreationParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreCreationParameters), serviceCallback); + } + + /** + * Creates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreCreationParameters The parameters for creating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String configStoreName, ConfigurationStoreInner configStoreCreationParameters) { + return createWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreCreationParameters).map(new Func1, ConfigurationStoreInner>() { + @Override + public ConfigurationStoreInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreCreationParameters The parameters for creating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String configStoreName, ConfigurationStoreInner configStoreCreationParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (configStoreCreationParameters == null) { + throw new IllegalArgumentException("Parameter configStoreCreationParameters is required and cannot be null."); + } + Validator.validate(configStoreCreationParameters); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), configStoreCreationParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreCreationParameters The parameters for creating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationStoreInner object if successful. + */ + public ConfigurationStoreInner beginCreate(String resourceGroupName, String configStoreName, ConfigurationStoreInner configStoreCreationParameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreCreationParameters).toBlocking().single().body(); + } + + /** + * Creates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreCreationParameters The parameters for creating a configuration store. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String configStoreName, ConfigurationStoreInner configStoreCreationParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreCreationParameters), serviceCallback); + } + + /** + * Creates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreCreationParameters The parameters for creating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationStoreInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String configStoreName, ConfigurationStoreInner configStoreCreationParameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreCreationParameters).map(new Func1, ConfigurationStoreInner>() { + @Override + public ConfigurationStoreInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreCreationParameters The parameters for creating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationStoreInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String configStoreName, ConfigurationStoreInner configStoreCreationParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (configStoreCreationParameters == null) { + throw new IllegalArgumentException("Parameter configStoreCreationParameters is required and cannot be null."); + } + Validator.validate(configStoreCreationParameters); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), configStoreCreationParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Deletes a 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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String configStoreName) { + deleteWithServiceResponseAsync(resourceGroupName, configStoreName).toBlocking().last().body(); + } + + /** + * Deletes a 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String configStoreName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, configStoreName), serviceCallback); + } + + /** + * Deletes a 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 + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String configStoreName) { + return deleteWithServiceResponseAsync(resourceGroupName, configStoreName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a 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 + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String configStoreName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a 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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String configStoreName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, configStoreName).toBlocking().single().body(); + } + + /** + * Deletes a 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String configStoreName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, configStoreName), serviceCallback); + } + + /** + * Deletes a 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String configStoreName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, configStoreName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String configStoreName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Updates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreUpdateParameters The parameters for updating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationStoreInner object if successful. + */ + public ConfigurationStoreInner update(String resourceGroupName, String configStoreName, ConfigurationStoreUpdateParameters configStoreUpdateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreUpdateParameters).toBlocking().last().body(); + } + + /** + * Updates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreUpdateParameters The parameters for updating a configuration store. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String configStoreName, ConfigurationStoreUpdateParameters configStoreUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreUpdateParameters), serviceCallback); + } + + /** + * Updates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreUpdateParameters The parameters for updating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String configStoreName, ConfigurationStoreUpdateParameters configStoreUpdateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreUpdateParameters).map(new Func1, ConfigurationStoreInner>() { + @Override + public ConfigurationStoreInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreUpdateParameters The parameters for updating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String configStoreName, ConfigurationStoreUpdateParameters configStoreUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (configStoreUpdateParameters == null) { + throw new IllegalArgumentException("Parameter configStoreUpdateParameters is required and cannot be null."); + } + Validator.validate(configStoreUpdateParameters); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), configStoreUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreUpdateParameters The parameters for updating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConfigurationStoreInner object if successful. + */ + public ConfigurationStoreInner beginUpdate(String resourceGroupName, String configStoreName, ConfigurationStoreUpdateParameters configStoreUpdateParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreUpdateParameters).toBlocking().single().body(); + } + + /** + * Updates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreUpdateParameters The parameters for updating a configuration store. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String configStoreName, ConfigurationStoreUpdateParameters configStoreUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreUpdateParameters), serviceCallback); + } + + /** + * Updates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreUpdateParameters The parameters for updating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationStoreInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String configStoreName, ConfigurationStoreUpdateParameters configStoreUpdateParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, configStoreName, configStoreUpdateParameters).map(new Func1, ConfigurationStoreInner>() { + @Override + public ConfigurationStoreInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a configuration store with the specified parameters. + * + * @param resourceGroupName The name of the resource group to which the container registry belongs. + * @param configStoreName The name of the configuration store. + * @param configStoreUpdateParameters The parameters for updating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationStoreInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String configStoreName, ConfigurationStoreUpdateParameters configStoreUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (configStoreUpdateParameters == null) { + throw new IllegalArgumentException("Parameter configStoreUpdateParameters is required and cannot be null."); + } + Validator.validate(configStoreUpdateParameters); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), configStoreUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists the access key for the specified 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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ApiKeyInner> object if successful. + */ + public PagedList listKeys(final String resourceGroupName, final String configStoreName) { + ServiceResponse> response = listKeysSinglePageAsync(resourceGroupName, configStoreName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the access key for the specified 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listKeysAsync(final String resourceGroupName, final String configStoreName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listKeysSinglePageAsync(resourceGroupName, configStoreName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the access key for the specified 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 + * @return the observable to the PagedList<ApiKeyInner> object + */ + public Observable> listKeysAsync(final String resourceGroupName, final String configStoreName) { + return listKeysWithServiceResponseAsync(resourceGroupName, configStoreName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the access key for the specified 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 + * @return the observable to the PagedList<ApiKeyInner> object + */ + public Observable>> listKeysWithServiceResponseAsync(final String resourceGroupName, final String configStoreName) { + return listKeysSinglePageAsync(resourceGroupName, configStoreName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listKeysNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the access key for the specified 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 + * @return the PagedList<ApiKeyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listKeysSinglePageAsync(final String resourceGroupName, final String configStoreName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String skipToken = null; + return service.listKeys(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listKeysDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the access key for the specified 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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ApiKeyInner> object if successful. + */ + public PagedList listKeys(final String resourceGroupName, final String configStoreName, final String skipToken) { + ServiceResponse> response = listKeysSinglePageAsync(resourceGroupName, configStoreName, skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the access key for the specified 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listKeysAsync(final String resourceGroupName, final String configStoreName, final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listKeysSinglePageAsync(resourceGroupName, configStoreName, skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the access key for the specified 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 + * @return the observable to the PagedList<ApiKeyInner> object + */ + public Observable> listKeysAsync(final String resourceGroupName, final String configStoreName, final String skipToken) { + return listKeysWithServiceResponseAsync(resourceGroupName, configStoreName, skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the access key for the specified 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 + * @return the observable to the PagedList<ApiKeyInner> object + */ + public Observable>> listKeysWithServiceResponseAsync(final String resourceGroupName, final String configStoreName, final String skipToken) { + return listKeysSinglePageAsync(resourceGroupName, configStoreName, skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listKeysNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the access key for the specified configuration store. + * + ServiceResponse> * @param resourceGroupName The name of the resource group to which the container registry belongs. + ServiceResponse> * @param configStoreName The name of the configuration store. + ServiceResponse> * @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 + * @return the PagedList<ApiKeyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listKeysSinglePageAsync(final String resourceGroupName, final String configStoreName, final String skipToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listKeysDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listKeysDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Regenerates an access key for the specified 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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiKeyInner object if successful. + */ + public ApiKeyInner regenerateKey(String resourceGroupName, String configStoreName) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, configStoreName).toBlocking().single().body(); + } + + /** + * Regenerates an access key for the specified 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeyAsync(String resourceGroupName, String configStoreName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, configStoreName), serviceCallback); + } + + /** + * Regenerates an access key for the specified 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 + * @return the observable to the ApiKeyInner object + */ + public Observable regenerateKeyAsync(String resourceGroupName, String configStoreName) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, configStoreName).map(new Func1, ApiKeyInner>() { + @Override + public ApiKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates an access key for the specified 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 + * @return the observable to the ApiKeyInner object + */ + public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String configStoreName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String id = null; + RegenerateKeyParameters regenerateKeyParameters = new RegenerateKeyParameters(); + regenerateKeyParameters.withId(null); + return service.regenerateKey(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), this.client.acceptLanguage(), regenerateKeyParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Regenerates an access key for the specified 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 id The id of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiKeyInner object if successful. + */ + public ApiKeyInner regenerateKey(String resourceGroupName, String configStoreName, String id) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, configStoreName, id).toBlocking().single().body(); + } + + /** + * Regenerates an access key for the specified 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 id The id of the key to regenerate. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeyAsync(String resourceGroupName, String configStoreName, String id, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, configStoreName, id), serviceCallback); + } + + /** + * Regenerates an access key for the specified 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 id The id of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiKeyInner object + */ + public Observable regenerateKeyAsync(String resourceGroupName, String configStoreName, String id) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, configStoreName, id).map(new Func1, ApiKeyInner>() { + @Override + public ApiKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates an access key for the specified 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 id The id of the key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiKeyInner object + */ + public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String configStoreName, String id) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (configStoreName == null) { + throw new IllegalArgumentException("Parameter configStoreName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + RegenerateKeyParameters regenerateKeyParameters = new RegenerateKeyParameters(); + regenerateKeyParameters.withId(id); + return service.regenerateKey(this.client.subscriptionId(), resourceGroupName, configStoreName, this.client.apiVersion(), this.client.acceptLanguage(), regenerateKeyParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ConfigurationStoreInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the configuration stores for a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the configuration stores for a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the configuration stores for a given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConfigurationStoreInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ConfigurationStoreInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the configuration stores for a given resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigurationStoreInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the configuration stores for a given resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConfigurationStoreInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists the access key for the specified configuration store. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ApiKeyInner> object if successful. + */ + public PagedList listKeysNext(final String nextPageLink) { + ServiceResponse> response = listKeysNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the access key for the specified configuration store. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listKeysNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listKeysNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the access key for the specified configuration store. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiKeyInner> object + */ + public Observable> listKeysNextAsync(final String nextPageLink) { + return listKeysNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the access key for the specified configuration store. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiKeyInner> object + */ + public Observable>> listKeysNextWithServiceResponseAsync(final String nextPageLink) { + return listKeysNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listKeysNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the access key for the specified configuration store. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiKeyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listKeysNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listKeysNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listKeysNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listKeysNextDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/NameAvailabilityStatusInner.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/NameAvailabilityStatusInner.java new file mode 100644 index 0000000000000..f56c92e48983b --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/NameAvailabilityStatusInner.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result of a request to check the availability of a resource name. + */ +public class NameAvailabilityStatusInner { + /** + * The value indicating whether the resource name is available. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /** + * If any, the error message that provides more detail for the reason that + * the name is not available. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * If any, the reason that the name is not available. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private String reason; + + /** + * Get the value indicating whether the resource name is available. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get if any, the error message that provides more detail for the reason that the name is not available. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get if any, the reason that the name is not available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/OperationDefinitionInner.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/OperationDefinitionInner.java new file mode 100644 index 0000000000000..fa06a53944b99 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/OperationDefinitionInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration.implementation; + +import com.microsoft.azure.management.appconfiguration.OperationDefinitionDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a configuration store operation. + */ +public class OperationDefinitionInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The display information for the configuration store operation. + */ + @JsonProperty(value = "display") + private OperationDefinitionDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display information for the configuration store operation. + * + * @return the display value + */ + public OperationDefinitionDisplay display() { + return this.display; + } + + /** + * Set the display information for the configuration store operation. + * + * @param display the display value to set + * @return the OperationDefinitionInner object itself. + */ + public OperationDefinitionInner withDisplay(OperationDefinitionDisplay display) { + this.display = display; + return this; + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/OperationsInner.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/OperationsInner.java new file mode 100644 index 0000000000000..4170f1e8bb684 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/OperationsInner.java @@ -0,0 +1,476 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.appconfiguration.CheckNameAvailabilityParameters; +import com.microsoft.azure.management.appconfiguration.ErrorException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private AppConfigurationManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, AppConfigurationManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.Operations checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailabilityParameters checkNameAvailabilityParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.Operations list" }) + @GET("providers/Microsoft.AppConfiguration/operations") + Observable> list(@Query("api-version") String apiVersion, @Query("$skipToken") String skipToken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appconfiguration.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Checks whether the configuration store name is available for use. + * + * @param name The name to check for availability. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NameAvailabilityStatusInner object if successful. + */ + public NameAvailabilityStatusInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Checks whether the configuration store name is available for use. + * + * @param name The name to check for availability. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Checks whether the configuration store name is available for use. + * + * @param name The name to check for availability. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityStatusInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, NameAvailabilityStatusInner>() { + @Override + public NameAvailabilityStatusInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the configuration store name is available for use. + * + * @param name The name to check for availability. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityStatusInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + CheckNameAvailabilityParameters checkNameAvailabilityParameters = new CheckNameAvailabilityParameters(); + checkNameAvailabilityParameters.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), checkNameAvailabilityParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists the operations available from this provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationDefinitionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the operations available from this provider. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the operations available from this provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationDefinitionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the operations available from this provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the operations available from this provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String skipToken = null; + return service.list(this.client.apiVersion(), skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the operations available from this provider. + * + * @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 ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationDefinitionInner> object if successful. + */ + public PagedList list(final String skipToken) { + ServiceResponse> response = listSinglePageAsync(skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the operations available from this provider. + * + * @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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the operations available from this provider. + * + * @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 + * @return the observable to the PagedList<OperationDefinitionInner> object + */ + public Observable> listAsync(final String skipToken) { + return listWithServiceResponseAsync(skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the operations available from this provider. + * + * @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 + * @return the observable to the PagedList<OperationDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync(final String skipToken) { + return listSinglePageAsync(skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the operations available from this provider. + * + ServiceResponse> * @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 + * @return the PagedList<OperationDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String skipToken) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists the operations available from this provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationDefinitionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the operations available from this provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the operations available from this provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationDefinitionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the operations available from this provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationDefinitionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the operations available from this provider. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/PageImpl.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/PageImpl.java new file mode 100644 index 0000000000000..d213e76d33aed --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.appconfiguration.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/package-info.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/package-info.java new file mode 100644 index 0000000000000..33e7abfb4e936 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for AppConfigurationManagementClient. + */ +package com.microsoft.azure.management.appconfiguration.implementation; diff --git a/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/package-info.java b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/package-info.java new file mode 100644 index 0000000000000..2da55afe106f4 --- /dev/null +++ b/azure-mgmt-appconfiguration/src/main/java/com/microsoft/azure/management/appconfiguration/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for AppConfigurationManagementClient. + */ +package com.microsoft.azure.management.appconfiguration;